WordPress / gutenberg

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

Front Page template: Include homepage settings #52335

Open jameskoster opened 1 year ago

jameskoster commented 1 year ago
front page

Front Page is the only template that will unilaterally resolve to the site homepage regardless of:

  1. Which other templates exist.
  2. Whether the homepage is set to display latest posts or a static page.

This makes it a good place to surface homepage settings in the site editor.

When set to display latest posts, settings relating to the blog (e.g. posts per page) can be surfaced.

When displaying a static page, the user should be able to choose which page content (page_on_front) to pull in, and which page should serve as the posts page (page_for_posts).

annezazu commented 11 months ago

Noting that we should consider surfacing these homepage settings when live previewing a block theme. Knowing what's going to happen with your homepage template when switching is critical and can change based on the theme. This can worsen due to this issue https://github.com/WordPress/gutenberg/issues/25071 where you can face a form of content loss when switching and losing homepage content depending on how the template was setup.

richtabor commented 11 months ago

We really need to figure out a way to consolidate this. Would be nice if it wasn't theme dependent, but I don't know what that looks like.

I still think it's confusing to have a "Front Page" within the editor, and an option to change its content via another page (like the "Welcome" page is referenced above. I wonder if something along the lines of a "Make this my homepage" setting in the Pages view, which would then make that exactly the homepage, would work better than the template v. blog v. page confusion we're facing now.

And then perhaps the details view on the left would always reference the site's homepage, with surfaced controls relevant to the blocks on the page (such as posts per page, if there is a query loop on the page).

SaxonF commented 11 months ago

I wonder if something along the lines of a "Make this my homepage" setting in the Pages view, which would then make that exactly the homepage, would work better than the template v. blog v. page confusion we're facing now.

And then perhaps the details view on the left would always reference the site's homepage, with surfaced controls relevant to the blocks on the page (such as posts per page, if there is a query loop on the page).

The template hierarchy is just a source of confusion all round and I'd love to discuss whether there is a pathway towards simplifying. Templates just being "dumb" wrappers around pages. Dream state:

If you don't want a blog, just remove the blog page.

jameskoster commented 11 months ago

Agree the intrinsic link between templates, 'dynamic pages', and settings makes for a very opaque experience, and that "Dumb" templates could make more sense in the site editor/block theme world.

Homepage is just a page that can be set as home as @richtabor suggested. You can apply whatever template you want to the homepage

This is already possible for regular pages, and would work for dynamic pages like the blog, shop, portfolio, etc. if Saxon's proposal above was implemented. The issue is that Front Page will continue to override whatever template is applied unless it's removed, or its behavior is adjusted. This could have very serious backwards compatibility consequences so would require very careful planning. One option might be to remove it's special behavior (IE convert it to a dumb template) and assign it to the current homepage automatically on update. The same treatment could potentially be applied to similar templates like home.html, category-recipes.html, etc.

One other consideration is theme switching. Ideally themes retain the ability to be somewhat opinionated about the homepage appearance (that's what templates like Front Page and Home were created for initially) without significant user intervention. Perhaps that could be handled a part of a theme onboarding experience?

richtabor commented 11 months ago

The issue is that Front Page will continue to override whatever template is applied unless it's removed, or its behavior is adjusted.

Wouldn't that still be the "Home" page though? Do we need a different details view (or any indicator) in the UI if your theme uses a front page, posts for home, or home template?

jameskoster commented 11 months ago

I was mostly responding to this part: "You can apply whatever template you want to the homepage", and the "dumb template" idea in general when Front Page exists. Getting the backwards compatibility right is tricky, so perhaps that's better discussed elsewhere.

Do we need a different details view (or any indicator) in the UI if your theme uses a front page, posts for home, or home template?

When Front Page exists the user cannot swap the template applied to their static homepage, and it's not really clear why. Similar for Home – you have a "Posts page" alongside your other pages, but you cannot change the template. Basically, for these cases (and for taxonomy archives) I think we need to try and combine the template in the page in the UX so that the user interprets them as one and the same. Perhaps we can achieve this by leaning into patterns, IE:

jameskoster commented 10 months ago

I wonder if something along the lines of a "Make this my homepage" setting in the Pages view

I made a quick mockup of how this might work in the details panel:

Homepage

If the current homepage is set to display latest posts the user is prompted to create a page (or choose an existing one) for the blog. They can skip this if they don't need a blog at that moment. If no blog pages exists then perhaps the [+] button in the Pages panel could include a "Add a blog" option. This would ensure the full scope of the homepage settings are accounted for in the Site Editor.

getdave commented 10 months ago

I've been thinking about this as well so I was pleased to find this Issue and the mockups. To avoid cluttering this Issue I've made another Issue on the specific point of finding and editing the Home page.

I'm not sure if I'm duplicating here but I want to avoid additional noise - let me know if you think it's a duplicate.

Note: my rationale in https://github.com/WordPress/gutenberg/issues/56244 is based on observations from several user testing sessions.

annezazu commented 2 months ago

Noting that the details view has been removed in favor of the Inspector so these designs will need to be refreshed: https://github.com/WordPress/gutenberg/issues/59689

jameskoster commented 2 months ago

Noting that the details view has been removed in favor of the Inspector so these designs will need to be refreshed: https://github.com/WordPress/gutenberg/issues/59689

I updated the design to reflect this change. The UI in the popover more accurately reflects the reading settings. Feedback welcome!

richtabor commented 2 months ago

Question. If a theme does not have a frontpage template, then they wouldn't have these settings easily available to set these reading settings, yea?

Would this same setting be available on whatever the home of the site is, regardless of template?

jameskoster commented 2 months ago

@richtabor I'm working on a few issues closely-related to address that, feedback very welcome:

These would allow users to (indirectly) update the reading settings in a variety of flows. I don't know that we're ready to fully replicate the reading settings UI in the Site Editor yet, given we'll eventually get to that with the admin redesign project (https://github.com/WordPress/gutenberg/issues/53322).