-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Site Editor Pages: load the appropriate template if posts page set #52266
Conversation
Size Change: +40 B (0%) Total Size: 1.42 MB
ℹ️ View Unchanged
|
This is working well except for this part:
The Posts Page can only resolve to display the Home or Index template. So we can remove the Front Page affordance. Side note: This change will emphasise #51421 a little more. It would be really nice to address that one. Side note 2: The one thing we miss with this change is a url to view the 'page' in the details panel. I'll see if I can add that back in a follow-up. |
Ah, no worries. Thanks. I'll update.
True, I noticed that. I would even say that #51421 should take priority over this one and others as I think we could make a stronger argument that it's a bug and therefore grease its path into 6.3. |
Flaky tests detected in b893a71. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5502919456
|
I agree #51421 should be prioritised, but I don't think it's a blocker since the issue exists elsewhere. Thanks for the updates to this PR, the Posts Page no longer redirects to the Front Page template when it is present ✅ However, it's also not redirecting to the Home or Index template, but to the page details: blog.mp4 |
By the way, we should also ensure that a static homepage redirects to the Front Page template, when it exists. If you'd like to handle that separately let me know and I'll open an issue. |
if I create a front page template, selecting the posts page shows the correct preview using the home template, but in the sidebar it shows the page name. Not Blog Home with the extra settings. |
@carolinan Whichever page is set to display latest posts in reading settings (IE the 'homepage' or the 'Posts page'), should reveal the Home / Index template when accessed via the Pages panel. Edit: I suppose if the reading settings specify that the 'homepage' displays 'latest posts', and the Front Page template exists, then yes it would probably be good to include some of the blog settings there. |
I am not sure I understand, I meant when:
Shouldn't that page sidebar still have the options for the number of posts to show, etc? That is still the page and template that are showing the posts. Just not as the first page of the site. |
The scenario you describe is the same as the one in the original issue: #52114 Displaying the page details isn't particularly useful because of its unique behavior. It's also strange when you engage edit mode because there is nothing in the page you can edit with blocks. So you have to swap to template editing manually which is unnecessarily convoluted. The conclusion was that in this scenario is makes most sense to just go directly to the appropriate template when the Posts page is selected in the Pages panel. |
I think we are talking about the same thing, that the PR is not ready yet because there is a scenario where it does not go to the template... |
ea28424
to
6729ca6
Compare
Here are the scenarios as far as I can tell. I'm just jotting this down for my benefit :)
Hopefully the latest updates to the PR gets us closer 🤞🏻 |
There is one more scenario:
I have confirmed that when the posts page is selected under Appearance > Editor > Pages, the home template is shown. Windows 10, Chrome, WP 6.3 beta. 2 a -works |
Thanks for testing @carolinan! I'm unfortunately away tomorrow so feel free to push to this branch. |
1c isn't quite working right. When I click the Posts page in the Pages list, I see a hybrid panel which includes the page details and blog settings. It should just redirect to the Blog Home template as it does in 1b. The rest are working as expected. For 2c it would be really great to include the blog settings (posts per page & discussion) in the Front Page template. But if you want to handle that separately it's probably fine.
In my testing this is effectively the same as scenario 1, so as noted above doesn't work correctly when the Front Page template exists. Thank you all for your perseverance on this one. |
Oh, got it. Thanks for the clarification.
It should be easy to just flip the switch on this, but with the following caveat: the front page template could contain anything and won't necessarily have any query loops. And, if it does, they might be buried in which case we'd have to flatten the block tree to find them which could get expensive. |
6729ca6
to
21b3a2b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all seems to be working now, thank you so much!
It should be easy to just flip the switch on this, but with the following caveat: the front page template could contain anything and won't necessarily have any query loops. And, if it does, they might be buried in which case we'd have to flatten the block tree to find them which could get expensive.
That's a fair point. Perhaps we tackle this separately, as a part of #52335.
Thanks for retesting and keeping me on the rails! 😄 |
- links the posts page to the homepage template when a post page is set - abstracts logic to get page item props
…dding a check to skip the Front Page
…ge in reading settings
… the home template, then the index template. The fallback is the post id of the page.
…tion-screen-page/index.js Will do it in a follow up
9829243
to
b893a71
Compare
I think this one slipped through the latest beta. Have marked it for RC 1 if folks agree. |
…52266) * This commit: - links the posts page to the homepage template when a post page is set - abstracts logic to get page item props * The Posts Page resolves to display the Home or Index template only. Adding a check to skip the Front Page * Showing homepage settings for posts pages that are set as the post page in reading settings * Post pages that have been set to display posts will redirect to first the home template, then the index template. The fallback is the post id of the page. * Reverted refactor of packages/edit-site/src/components/sidebar-navigation-screen-page/index.js Will do it in a follow up
I just cherry-picked this PR to the update/first-batch-pre-RC1 branch to get it included in the next release: 3324c2a |
* Site Editor: Restore quick inserter 'Browse all' button (#52529) * Site Editor: Restore quick inserter 'Browse all' button * Remove leftover comment * Patterns: update the title of Pattern block in the block inspector card (#52010) * Site Editor Pages: load the appropriate template if posts page set (#52266) * This commit: - links the posts page to the homepage template when a post page is set - abstracts logic to get page item props * The Posts Page resolves to display the Home or Index template only. Adding a check to skip the Front Page * Showing homepage settings for posts pages that are set as the post page in reading settings * Post pages that have been set to display posts will redirect to first the home template, then the index template. The fallback is the post id of the page. * Reverted refactor of packages/edit-site/src/components/sidebar-navigation-screen-page/index.js Will do it in a follow up * Allow editing existing footnote from formats toolbar (#52506) * Block Editor: Display variation icon in the 'BlockDraggable' component (#52502) * Patterns: add option to set sync status when adding from wp-admin patterns list (#52352) * Show a modal to set sync status if adding pattern from pattern list page * Make sure the modal loads if post settings panel not open * don't load modal component at all if not new post * Simplify the sync status so undefined always = synced * Update packages/editor/src/components/post-sync-status/index.js --------- Co-authored-by: Ramon <ramonjd@users.noreply.github.com> * Revise LinkControl suggestions UI to use MenuItem (#50978) * Use "link" instead of "URL" for URL_TYPE * Use MenuItem for search create button * Use sentence case for "Create page" * Use a MenuGroup for search results * Use MenuItem for search item * Refactoring styles (WIP) * Preserve whitespace in results text * Reinstate result item information including permalink * Remove debugging CSS code * Reinstate CSS to control size of rich previews favicon * Remove other commented out CSS code * Reinstate selected styles * Remove more redundant CSS * Add some basic results hover/focus styling. Needs improving * Improve icon alignment * Update tests to handle wording changes * Remove inconsistent hover/focus style MenuItem already has hover/focus styles * Reinstate is-selected visual state * Update test to make sense in context of #51011 See #51011 * Fix locator for result text --------- Co-authored-by: Dave Smith <getdavemail@gmail.com> * Fix LinkControl mark highlight to bold (#52517) * Add 'reusable' keyword to Pattern blocks (#52543) * Fix missing Add Template Part button in Template Parts page (#52542) * Tweak copy for the reusable block rename hint (#52581) * Trim footnote anchors from excerpts (#52518) * Trim footnote anchors from excerpts * Add comments, fix spacing, appease linter * Site Editor: Reset device preview type when exiting the editing mode (#52566) * Make "My patterns" permanently visible (#52531) * Hide site hub when resizing frame upwards to avoid overlap (#52180) * Fix "Manage all patterns" link appearance (#52532) * Fix "Manage all patterns" link * Update focus style * Update navigation menu title size & weight in detail panels (#52477) * Update menu title size * Adjust font weight * Site Editor Patterns: Ensure sidebar does not shrink when long pattern titles are used (#52547) * Edit Site: Select templateType from the store inside the useSiteEditorSettings hook (#52503) * Add width to ensure ellipsis is applied (#52575) * Cover Block: Fix block deprecation when fixed background is enabled (#51612) * ResizableFrame: Make keyboard accessible (#52443) * ResizableFrame: Make keyboard accessible * Fix outline in Safari * Use proper CSS modifier * Add aria-label to button * Keep handle enlarged when resizing (Safari) * Add back visually hidden help text * Don't switch to edit mode * Make the handle a role="separator" * Revert to `button` * Switch description text to `div hidden` * Prevent keydown event default when right/left arrow * Change minimum frame width to 320px * Mention shift key in description text * Only render resize handle when in View mode * Fix importing classic menus (#52573) * use the same create hook for classic import * Remove redundant arg to hook --------- Co-authored-by: Dave Smith <getdavemail@gmail.com> * Site Editor: Fix navigation menu sidebar actions order and label (#52592) * Avoid errors in Dimension visualizers when switching between iframed and non-iframed editors (#52588) * Patterns: Add client side pagination to patterns list (#52538) Co-authored-by: Saxon Fletcher <saxonafletcher@gmail.com> * Site Editor: Make sidebar back button go *back* instead of *up* if possible (#52456) * Navigator: Add replace option to goTo() and goToParent() * Site Editor: Make sidebar back button go back instead of up if possible * Adapt template part hint copy (#52527) * Try "panel" instead of "page" * Update template-part-hint.js --------- Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com> Co-authored-by: Glen Davies <glendaviesnz@users.noreply.github.com> Co-authored-by: Ramon <ramonjd@users.noreply.github.com> Co-authored-by: Miguel Fonseca <150562+mcsf@users.noreply.github.com> Co-authored-by: Rich Tabor <hi@richtabor.com> Co-authored-by: Dave Smith <getdavemail@gmail.com> Co-authored-by: Robert Anderson <robert@noisysocks.com> Co-authored-by: James Koster <james@jameskoster.co.uk> Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com> Co-authored-by: arthur791004 <arthur.chu@automattic.com> Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com> Co-authored-by: Lena Morita <lena@jaguchi.com> Co-authored-by: Andrei Draganescu <me@andreidraganescu.info> Co-authored-by: Saxon Fletcher <saxonafletcher@gmail.com>
What?
Resolves: #52114
This PR:
How?
Checking if
posts_page
(from site settings) matches the current page id.Testing Instructions
Start off with a theme that has a home template, e.g., 2023
Set a posts/home page in the settings:
Head to the site editor, and navigate to the Pages pane in the sidebar.
Check that the posts page is in the list with the correct icon (verse) and that clicking it loads the current home template.
Create a
front-page
template and verify that the post page links to the front page template.Switch to a theme that has an index template only, e.g., empty theme.
Verify that the post page links to the index template.