-
Notifications
You must be signed in to change notification settings - Fork 99
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 select a default offline page to be served when the user or site is offline #23
Comments
Request For Feedback Hi @jwold, |
Bear in mind that we'd want to eventually allow whatever the selected page is to not just show static content but also be able to provide additional information, such as which posts of a given site are available offline, for example. One way would be for the selected page to be assigned a page template that has hard-coded logic displaying this information. But going forward probably the best practice would be to use a Gutenberg block that a site owner could drop into such a page regardless of the template. A shortcode could also be provided if Gutenberg is not available. In this way, we could eventually show a warning when an offline page lacks the block/shortcode in the content. |
Something else to remember is that when a page is designated as an offline page, we probably shouldn't encourage site authors to link directly to that page (like in a nav menu) or allow search engines to access it. It should probably get a |
@kienstra I like the suggested UI you've shown. The only change I might suggest is to simplify the second button, otherwise it's hard to know what to look at. Having a primary and secondary action is always helpful instead of two conflicting actions that look the same. Can we do an anchor tag inside of a form element? |
Looks Good Hi @jwold, |
Another Possible UI Hi @westonruter, Of course, the "edit offline page" link would lead to the editor: As you suggested, this could be a custom post type, so it doesn't appear in nav menus or searches. |
I think it should still mirror the privacy policy page as much as possible: Or as @jwold suggested with a link instead.
Actually it should have a custom post status. |
Hi @westonruter, |
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 That being the case, the content of the page could actually vary based on what kind of error it is. Perhaps when when the |
There are some important discussion regarding the designated offline page on #9. For example #9 (comment):
|
And actually, a custom post status is more or less a hack to prevent the page from showing up in nav menus and from being accessed as a page on the frontend. A better way to prevent it from showing up in nav menus could be to just filter them to exclude this page. I assume there would be a |
What if we have an non-public status but you can access it with a get-parameter? |
Agreed. The URL doesn't need to be pretty. But it should also be accessible for testing even when you're not offline. So some special |
In the proposed UI, @kienstra notes that the page attributes are not required for the Offline Page. That's true. I mocked up a solution to remove it from the Classic and Gutenberg editors and the Quick Edit UI too (though the JS solution uses In thinking about this, the To be consistent, I propose that we leave the page attributes for the offline page. |
Page Attributes: Good Idea Hi @hellofromtonya, |
This commit excludes the offline page from rendering on the frontend. A 404 is served up. When using plain permalinks, e.g. https://example.com?page_id=28, it will find and render the offline page. This is an incompletion strategy per conversations in Issue #23 @see #23 (comment).
Request For Another Issue Hi @postphotos,
|
Scenario: The offline page is existing and already assigned in one or more menus. Problem to discuss: How do we want to handle this situation? [ ] Prevent Looking for input from @kienstra @amedina @jwold @postphotos ContextThe UI currently looks like this: where, the assigned Offline Page is filtered out and excluded from the Possible Solutions1. PreventOne way to go is to prevent selection of an existing page that is already in one or more menus. How? Exclude these pages from the offline page dropdown select in the Settings > Reading UI. Pros:
Problems:
Imagine that s/he has already setup the page to be the offline page with the content needed. Not appearing in the dropdown would be confusing. 2. AlertAnother option is to alert by with an error message on the Pros:
Problems:
3. Alert and automatically removeThis possible solution combines alerting from above with automatically removing the offline page's menu item from each menu. Pros:
Problems:
Revised - If the page in question is a parent menu item, we are not able to automatically remove that item from the menu structure. Why? Because the children menu items will shift over one level. We've changed the sub-menu structure. In this case, we would need the admin to manually decide what the new structure will be. Proposed SolutionI'd recommend Option 2 Alert. Why? Informs of what action(s) need to happen, while giving flexibility to the admin to rectify the menu structures. It's also less risk for impact due to future UI changes. What do you think? |
Great outlining of options, @hellofromtonya! I’m not a huge fan of option 1. Showing greyed-out or not-functional options to a user is just frustrating, because it just tells them “no” instead of providing an easy path forward. I resonate with a solution that’s somewhere between 2 and 3. Here’s my line of reasoning:
If we warn a user after they’ve selected an offline page and it’s been removed from menus, we’re only communicating the damage they’ve already done. That’s not optimal. If we warn the user about what will happen before they confirm their choice, then they can make the choice to use a different page or to let it be removed from menus. This seems ideal to me. So, maybe it would look something like this:
Even in the case that the page is not in any menus, the user should get a notice saying they will then not be able to add the offline page to menus. This could also just be solved by not listing the offline page in the menus’ add page interface, though we face a similar user-in-control dilemma there. It’s possible I misunderstood what you meant with this:
Would you mind clarifying what those questions are—or at least give a sampling? |
@kevincoleman Sure. Imagine that the existing Offline Page is a parent menu item and has child menu items under it. If we automatically delete the Offline Page from the menu structure, what happens to the children? They slide over one level. Now, we've changed the menu structure itself. What I meant then about In essence, if the offline page is a parent in the menu structure, automatic removal is not possible. We need someone to manually decide what the new structure should be. If we pick solution 3, we will have special cases where we cannot automatically remove a menu. In those cases, we need to prompt and guide the admin for how s/he could manually resolve the issue. When the page is not a parent, we can automatically resolve the problem without work from the admin. Though it's more development work, it is a better user experience. |
Ah, that does make sense. Thanks for clarifying! I think it’s probably fair to say that we should make the MVP of this feature first, then consider adding a dialog like option 3 implies as an additional improvement later. So, maybe we go back toward option 2, with clearly actionable links and messages to guide users to solve the problem themselves. We’d want to make sure the errors clearly communicate that the offline page won’t be functional until the menu items are removed. At least—it seems to me that it would be better to block the newly-turned-on feature (the offline page) than to block a previously-turned-on feature (the page appearing in menus). Graceful degradation and all that. Thoughts? |
@kevincoleman I think that's a smart approach. It is an MVP at this point. I do like option 3 for the long term solution as it is a better experience. |
When The Offline Page Is Already In A Menu Hi @hellofromtonya, I'd prefer option 1 (Prevent), though I'm open to other ideas. The offline page might be very different from existing pages. It might have a Gutenberg "Latest Posts" block, or it might be like a 404 page. I don't think it would be too hard to either create a new offline page, or select a page that's not in a menu yet. Still, it's possible that there are very few (or no) pages that aren't assigned to a menu. Like if a menu has checked "Automatically add new top-level pages to this menu" in Option 2 (Alert) is a good option also. It at least lets users know that they could cause a side-effect. |
Re-opening pending #23 (comment) request for @postphotos. |
Thanks @westonruter and @kienstra - happy to keep this open for the discussion regarding offline pages + PWA! |
The severity of the default offline page being in the menu structure is less than when I first noted the issue. Why? It no longer renders a 404. That said, we should discussion a solution to make the site owner aware. I’d propose a dismissible message and potentially a highlight around the item in the menu structure. Let’s continue our discussion to decide:
|
We're circling back on this in #52 |
##User story: As a WordPress administrator, I want to be able to select a page that displays when visitors are offline.
[ ] AC2 - This page should be served when offline.This AC has moved to ticket Add ability to serve the default offline page when the user or site is offline #45.This could be similar to the Settings > Privacy Settings page:
The offline page UI could look something like:
This is based on @westonruter's suggestion in #9 (comment).
The text was updated successfully, but these errors were encountered: