-
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
Automatically add newly published pages to the navigation block #16635
Comments
Yes that is the feature this issue is about :) |
I removed the |
What's the state of this? I think it still needs feedback as it's not clear:
|
I'm going to dive in here with some feedback to try and get this moving on.
I think 'off' for adding new pages makes sense as default. This is because for now you have to turn on for menus, so turning on here fits an existing mental model.
For me, again this falls to the existing model as that only does top level. I think only being top level makes a lot of sense as a starting point also.
I think this could be useful information. My suggestion would be something like this as an added note: This could go a little further by showing menus / linking to it, however, I think a gentle note is a great frst step. |
I disagree. I can count a lot more examples where I might have orphaned top level pages I don't want displayed in a menu compared to sub-pages. When adding a page that has sub-pages attached, I more often expect that those show up automatically, and then any new page I create as a child of it to be reflected in the menu so I don't need to manage parent / child in two places.
This seems super invisible to me. I was thinking something a lot more clear and ideally actionable — a link to the menu, a way to preview it, etc. |
@karmatosed I think your first direction works the best in cases where the toggle to "Automatically add new top-level pages", as in @shaunandrews ' mockup above, is switched on. The second and third options feel a bit more like warning/error notices. Just riffing on yours and Shaun's ideas: it might be helpful to explain what users can expect to happen when publishing a page when that toggle is switched on for that nav block. For example, perhaps we can show two states of that "Menu location" or whatever we want to call it in the component panel: When toggle to "Automatically add new top-level pages" is switched ON:
When toggle to "Automatically add new top-level pages" is switched OFF:
Another idea that came to mind while I was exploring the Nav block's Navigation Structure pane was introducing that same tree architecture in the pre-publish panel. That way we're not introducing new/different patterns that accomplish the same thing. Something like this, where the new page gets added to the site architecture and can be moved around: The current menu structure interface at |
@joanrho love the explorations. A couple of things to mention:
|
Thanks for the ideas @joanrho. The idea is yes this is an automatic process so I think adding weight at the end of the publishing flow probably for now should be avoided with the block navigator. My feeling is if you don't add that auto, it doesn't add and for now I think that's ok. I don't think you need to then have that complexity in publishing. I am not saying we don't do this at some point, the focus now is on automatically doing this so I feel we should make that work first. As shown in the first round of message blocks, just showing this is happening feels lighter to me. To that point, which of those do you feel is we can spring from? Next steps I feel:
I don't mind which for the visual but feel we should focus on that first. Once we've done that another issue could absolutely explore next steps like assigning navigation on publish and another about exploring if there is an off-state needed. I feel we need to focus on this first though, then work out if that flow is desirable. |
@draganescu pulling this point out as I think this is important to explore outside the mocks:
A starting version for me would be to have this just add to any with the setting. However, there is then going to be some refinement needed. This also plays into that:
Working out what is expected, what will be confusing, that's some refinement I think we can build up. |
I've been thinking of this from an implementation perspective and there are only two ways I found to have this work for the Navigation block if we use block storage (inline HTML + comment meta).
In a FSE environment menus would probably be in
The problems I see with this implementation are that we can't tell in what menu a page will end up (as pictured in the mockups above) and that when editing the block will be edited and the post type will have to be saved. @mtias can you think of anything else here? Again, this is only if we store navigation blocks like normal blocks in post content. If we decide to, for example, save it as it's own kind of CPT or save it as a wp_block cpt, then it's a different story. |
@draganescu: How do classic menus in WordPress accomplish this? |
hey @noisysocks Menus in WordPress manage an option called Then, This system, compared to block storage (attributes in post content), has some things going for it:
Without analyzing, I guess to achieve something similar we could store navigation as a wp_block post type and use the ID of these posts to hook into the options system. Updating the menus would still require more work than just inserting a menu item in a DB table, but at least we'd know exactly which menus need to be updated, and not need to search for them. |
Yes, so a decent solution could be to convert a Navigation block to a reusable block when the Creating Navigation blocks as reusable blocks by default also ties in nicely with the fact that current menus have "names" and so do reusable blocks. The we can also reference these blocks in the database directly by the |
Except that #18560 has to be fixed first! |
After a brief chat with @mtias it appears the best path forward to be using the This will allow us to identify a menu by id, keep a list of menus that should be automatically updated and also edit automatically only menu content. However, saving menus as
This brings a new option to the placeholder, create from existing Navigation. While #18869 creates from existing classic WordPress menus, we'll also need a way to create from existing Navigation block menus. This might mean that we move to "Import a classic menu" or something similar. |
Is there anything in this issue that wasn't covered in #27130? If not, can it be closed now? |
Well the feature itself does not exist yet for the standalone block. I think that this issue will be closed by having: a) a pages block that allows newly published pages to be automatically added |
My assumption is that having the Pages block (outlined in #23689) will mostly resolve this, albeit in a limited way. You'll be able to use the Pages block and show all pages, keeping things in sync all around — or, create a bespoke collection of Link blocks. I expect that the new Pages block could grow to allow more granular control over what pages are shown, which opens to door to more flexibility. |
I would definitely say the Page List block fixes this issue. I would consider it the way to keep menus in sync, and as soon as you "detach" the page list and convert it to individual menu items, then it's a customized menu. |
Closing this as #28265, which adds a self-updating Page list block, has been merged. |
Is your feature request related to a problem? Please describe.
This is a feature which exists in the current WordPress menus. If we want this block to be the cornerstone of a new and better menus page in WordPress admin (#16635) then we need to have this feature supported b/c the new menus need to behave identically.
Describe the solution you'd like
The Navigation block should support this toggle and both render and add newly published pages to its list of pages.
Note
While on the server at render time one could think of doing a diff between a list of published pages and the list in the currently rendering bloc, in the editor that would be weird as a newly added page would automatically make the post unsaved, since detecting a new page changes the contents of the Navigation block. Therefore this needs an UX discussion.
The text was updated successfully, but these errors were encountered: