-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Idea: Add support for custom theme template file to be used for offline page #50
Comments
There was some discussion about this in #9 (comment) However, the previous discussion was about using a custom template instead of having a page designated as the offline page. What I think you are suggesting is actually extending the template hierarchy to be able to select an
That's a good point, and it's related to #23 (comment). I don't think we'd want to provide a UI to select a page both for when the client is offline and when the server is offline, but if there were two separate template files which are served in these two different scenarios than this would be a way to easily show a different message based on why the page is not accessible, without requiring that the offline page be communicating with the service worker to determine the cause of the error. Note that this would require that precaching in #48 to request two separate URLs to cache, one URL for the page template used for offline and another for the 503 response. Perhaps a query var could be used to specify which template should be used when requesting the offline page. Nevertheless, if you select a custom page template should this not override the page template hierarchy? What if you want to select the page template for the offline case, but not for the 503 case? |
I think that would be a great compromise. We could add an offline.php detection. If the theme has an offline.php, the user should not be able to select an offline page. So the select box could be disabled an there could be a short text that explains that the offline.php will be used instead. And since this is optional we can expect from the theme author to add the assets from the offline.php to the SW through the API. |
|
This makes sense to me, and sorry I missed the earlier discussion about it too - forgot to look through closed issues! |
As noted in #52 the direction now is to not have a user-specified offline page but rather to only use a static So in this case, what I said in #50 (comment) is not relevant anymore, as there would be no queried object for the error template, unless a plugin introduces the ability for the user to select a page to serve offline. |
Thanks for the update @westonruter, this sounds perfectly logical to me. |
Although you can use a regular page as the offline page and choose a page template it might be desirable to let theme authors create a template file specifically for offline use as it could be quite different, eg. with no menus etc.
There are a couple of suitable options for this:
503.php
- service unavailable, also send the same status code? Not sure this is technically accurate to use, as it could be either the site or user who is offlineoffline.php
- not status code specific and self explanatoryThe text was updated successfully, but these errors were encountered: