-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Blog page title block displays first post title in query #38574
Comments
Hey there! Great question. To do this, you'll want to add the Post Title Block outside of the Query Loop. From there, that will display the page title. Here's a quick video showing a poorly designed template showing what I mean: page.title.movIf this isn't what you meant, let me know. For now, going to close this out :) |
Sorry @annezazu , I think I didn't expain my use-case correctly here. As I am aware, setting any page as the 'blog page' in WP options, makes this into a post archive that loads in the template hierarchy from home.php / home.html. That is the exact use case. The problem occurs outside of the query loop. It occurs on the home.html template where the 'post-title' block is assigned in a template-part; the header. Problem: The title displays the title of first post in the loop. Not the page title (which is blog in my case). The featured image block also displays the first posts' featured image. I don't know how the query post_id's are seeping into the header template-part to grab the title. It shouldn't. If it's in the header (or anywhere else) it should display the title of the current page, not a post in the query loop. edit: edit2: |
This should be re-opened. What the op 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 |
Thank you @bradhogan for verifying my struggle with this. No one is using archives because menu marking is missing, everyone throws queries in a page? Not sure why this was closed. It’s the default blog experience |
Description
When rendering the page, the title of the first post in the query loop is displayed as page title. Instead of the title of the page.
After that, I've tried to add Archive Title block instead, but this doesn't render anything at all.
Is this intended behavior? How do we add a title for the blog page? All I can think of right now is a static heading in the template.
Step-by-step reproduction instructions
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
The text was updated successfully, but these errors were encountered: