Configure application's default start page


#1

(Couldn’t find this topic in forum archive, but sorry for the dupe if it is already registered.)

Currently, the application’s root URL is the default start page for the application. When the application is ‘open’ in the live preview, the application resets to that default start page / root after each change in the editor… which is inconvenient at times.

My request: could the ‘live preview’ application stay on the current page / path, or could we specify some default start page?

Currently, my solution is to include this snippet in server.js:

app.get("/", function (request, response) {
  response.redirect('/default_start_page');
});

Unfortunately, that also introduces a redirect from root to /default_start_page.


#2

There’s currently no mechanism in place for setting a default page for the live preview. One possible workaround is to open a separate browser page pointing at the page you want and manually refreshing after you make changes. Thanks for the feedback!


#3

Don’t forget to uncheck the “Refresh App on Changes” checkbox!


#4

If you change application.coffee:737-738 from

if self.refreshPreviewOnChanges()
  previewWindow?.location = self.currentProject().publishedUrl()

to

if self.refreshPreviewOnChanges() and previewWindow?
  if previewWindow.location.indexOf(application.currentProject().publishedUrl()) is 0
    previewWindow.location = previewWindow.location
  else
    previewWindow.location = self.currentProject().publishedUrl()

You will be able to refresh the page if it’s on the project’s domain or reset it to the homepage if the user has navigated to a different domain.