WordPress / gutenberg

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

No way to display front page posts page title #53536

Open bradhogan opened 1 year ago

bradhogan commented 1 year ago

Description

This (https://github.com/WordPress/gutenberg/issues/38574) should be re-opened.

What the op in that ticket was talking about is that if you have your reading settings to let's say a "front page displays" and set your posts page to a page you have called called "blog" then in your block theme's index.html (let's assume there isn't a home.html because there doesn't have to be), then you add outside of the query block, the output is the first post title in the query (even if it is outside of the query block) when in fact it should display the page name ("blog" in this case).

Without this, there is currently no way of showing the page title for a site owner's blog page which is pretty crazy.

Step-by-step reproduction instructions

  1. add two pages called "home" and "blog"
  2. go to readings > settings > set your front page displays
  3. open the index.html file for the default theme
  4. outside of the query loop, add <!-- wp:post-title /--> and save
  5. view your posts page ("blog" in this case)
  6. notice the post title is showing the first blog post title rather than "blog"

Screenshots, screen recording, code snippet

No response

Environment info

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

jordesign commented 1 year ago

Confirmed this in testing. If the 'Title' block is inserted in a Home/Index template outside the Query Loop - it will show the title of the title of the first post, not the page itself.

Screenshot 2023-08-11 at 10 06 12 am

Template Editor

Screenshot 2023-08-11 at 10 06 23 am

Page Editor

Screenshot 2023-08-11 at 10 06 32 am

Front End

carlomanf commented 1 year ago

I thought this was a very old issue, and from some quick research, it seems to have been first reported 12 years ago: https://core.trac.wordpress.org/ticket/17470

The patch that was applied to that ticket predated the block editor and block themes, but as I never use the posts page, I'm not too familiar with what work was done to move it over. I also found some more recent tickets and patches that look related, particularly #52266, but perhaps it doesn't solve the issue comprehensively enough.