WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.35k stars 4.13k forks source link

Site Editor: Provide Context and Direct Links to Fix Empty Templates #64027

Open mrfoxtalbot opened 1 month ago

mrfoxtalbot commented 1 month ago

What problem does this address?

If a user deletes all the blocks in their templates, they will see:

Screenshot 2024-07-11 at 10 48 31 (1)

Despite our best efforts to lock template blocks and warn users when they are about to delete them, we still see users routinely getting stuck there. They are unsure why their site is showing black or how to fix it.

What is your proposed solution?

We should provide basic context so users can understand what happened and include direct links to help them fix it.

The Message

Let's explain that the templates necessary to display their content for the current view/template were deleted via the Site Editor.

This template is used to display X (single posts, archives, search results... etc). It looks like the template was deleted, you can restore to via Appearance > Editor > Templates > Template's Name. You can also click on the "Edit Site" link on the tool bar at the top to access this template directly (maybe include a screenshot!?)

The Links

Adding some (of all!) of these direct links would be useful:

We could also include more than one option!

Screenshot 2024-07-28 at 09 01 41

This enhancement could be relevant in the context of:

mtias commented 1 month ago

There's probably something more refined we can do here that connects better with the new template flows vs blank canvas start, including zoom out, starter layouts, etc.

mrfoxtalbot commented 1 month ago

My proposed solution was mostly to illustrate the problem but let's explore more ambitious and elegant solutions, for sure!

What did you have in mind, @mtias?

ariel-maidana commented 4 weeks ago

Suggestion: we could add a "Reset template" button to that page, which would trigger a confirmation message explaining the implications of the reset. Clicking on the confirmation button should do two things:

seifeldinio commented 4 weeks ago

To address this, here are two options:

Alert Message: Show an alert indicating the template might be deleted or empty, with buttons to Reset Template or Edit Template.

Mockup:

1

Card Component: Use a Card component to present the same message and actions more visually.

Mockup:

2

Would love to hear your thoughts!

richtabor commented 3 weeks ago

@annezazu do we know if this is common? I wonder if we are smarter with where "Edit site" call to actions are placed, if this would be less of a problem.

annezazu commented 3 weeks ago

This was noted as a common blocker for end users on WordPress.com that "creates a lot of confusion and support requests" from @mrfoxtalbot :) Curious to hear from more folks.

mrfoxtalbot commented 3 weeks ago

do we know if this is common?

@richtabor this is extremely common. I personally talk to users facing this problem at least 2-3 times a week on dotcom's live chat support. You can see plenty of examples in the dotcom forums. I'm sharing a link to the dotcom forums because the search results are more relevant but this is happening in the dotorg forums too:

I even found an example on Reddit :S

richtabor commented 3 weeks ago

I think we could come up with a simple empty state, where you can edit reset, pick from an existing template, or edit the empty template.

mtias commented 3 weeks ago

Yeah, it seems we can try the modal route as a simple start. We need to ensure it only renders on first load so you can actually have a blank template to start building with if you dismiss.

mrfoxtalbot commented 2 weeks ago

We need to ensure it only renders on first load so you can actually have a blank template to start building with if you dismiss.

@mtias , this "Empty Template: {Template Name}" shows in the public site, not in the editor. I do not see the "have a blank template to start building" part being relevant or helpful here.

In other words, if an admin faces a blank (empty) template when they visit their site, this "escape hatch" I propose should always be visible somewhere.

mtias commented 2 weeks ago

@mrfoxtalbot yeah, both things are a problem. A fully blank template should be caught while editing, and there should also be a pathway on the front for logged in / editor if it still occurs.

vcanales commented 1 week ago

Implementing a warning when the template is rendered requires a Core change rather than a change in Gutenberg.

I've created a track ticket and a PR with a proposed alert when rendering a blank template. The warning is only shown to logged-in users and points them through the button to the Site Editor page, where they can edit or Reset the template.

Notice that the warning page uses theme styles for buttons. This is the easiest way I found to avoid using more CSS for this alert.

Ticket, for discussion: https://core.trac.wordpress.org/ticket/62053 PR: https://github.com/WordPress/wordpress-develop/pull/7354

mrfoxtalbot commented 4 days ago

Thank you for working on this, @vcanales.

I'd like to polish how the message is worded and discuss the possibility of adding a secondary "reset template" link/button. The current "Edit template" option might not be super helpful for newbies.

vcanales commented 4 days ago

I'd like to polish how the message is worded and discuss the possibility of adding a secondary "reset template" link/button.

I looked into this, but directly resetting the template requires an API call which would make the modification more difficult to achieve and possibly too involved; the leaner we keep this change, the more likely it is to pass reviews later.

Could we compromise and add a "Reset Template" button on the screen where the user is prompted to select a Pattern? This is where users would land when they click the Edit Template button on the front end.

image

Something I like about this approach is that the Reset Template button could be useful beyond the problem we're trying to solve here.