Skip to content
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

Add ability to serve the default offline page when the user or site is offline #45

Closed
2 tasks done
hellofromtonya opened this issue Aug 3, 2018 · 0 comments · Fixed by #48
Closed
2 tasks done
Milestone

Comments

@hellofromtonya
Copy link
Contributor

hellofromtonya commented Aug 3, 2018

As an administrator site owner, I expect the selected default offline page to be served when either the user or site is offline.

  • AC1 Serve the default offline page when the requested page is not available offline.
  • AC2 Add is_offline to the query to denote. See Weston's comment.

Issue #23 added the ability to select the default offline page. Issue 23 includes conversations on how to serve the default offline page:

See Weston's comment:

Something important to note here I just realized: this offline page could be served not only when someone's internet is offline but also when the server itself experiences an internal server error (a 500 response). We should try to design the offline page so that it could be used for both use cases. There would need to be some client-side logic involved here, however, since the client would know if the page fails to be fetched because of a network error or a server error.

Important related issues in Issue #9 including this comment:

We could then serve it only if requesting with the query var as you suggested. If no offline page exists, then the response could be treated as is_404() to serve the not found message, which I think would be better then no offline page at all. (Alternatively, I wonder also if the template hierarchy should be extended so that is_offline() would be a special case under is_404().)

There are thousands of themes out there and it would take a long time for them to add an offline.php template. I don't think that should be a requirement before serving the offline page.

Requiring a special offline template would also not align with the template hierarchy expectation either. A minimal theme is only required to include an index.php template which gets used then to serve responses to all queries, including is_404(). A theme should also be able to use this generic index template to serve an offline response as well (is_offline()?). That would seen the most logical from a theme developer's perspective.

And Weston commented on PR 28:

The serving of the offline page should probably incorporate Workbox (#5) and also it will probably involve precaching (#25) since we'll need to make sure the offline page and its required assets get added to the cache.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants