-
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
New "Pages" Block: Display a list of links to a site's pages #23689
Comments
This is a thoughtful solution that will be a huge asset to 90% of folks building websites. Nice work. Side note: I do wonder if we should align the horizontal/vertical layout with the solution for the Nav block (which currently uses two blocks to solve that issue). |
@MichaelArestad Actually, the Navigation block doesn't technically use two blocks. Those are just two different block variations (a fairly recent API allowing different pre-configured versions of a block to be listed separately in the inserter). |
This should be fairly trivial to build, so no reason not to blaze a trail and try it in code. |
The challenge here is how to have the Pages block output multiple links as if those links were children of the Pages block's parent. Potentially we could have Pages render something like this: <div class="wp-block-pages" role="presentation">
<div class="wp-block-pages__link" role="menuitem">
<a href="...">...</a>
</div>
<div class="wp-block-pages__link" role="menuitem">
<a href="...">...</a>
</div>
</div> .wp-block-pages {
display: contents;
} The parent block could, using an API like the one proposed in #23915 (comment), see that a child is a Pages block and then: a) not surround that block with a |
Removing this from the Navigation project board as I don't think we should focus on it for WP 5.6 which is nine weeks away. I think it's definitely a required feature for Full Site Editing, though. |
Worked up another iteration on the design for this one. I've moved towards labelling the block "Page Listing," exposed the sub-menu toggle into the toolbar, and added a new inspector option for setting an explicit parent. This GIF runs through a few things:
|
"Page Listing" is good! |
"Listing" generally means a single item out of a list, doesn't it? Hence why we say things like "job listings" (notice the "s"). I think "Page List" would make more sense. |
How does this work when the Pages block is a child of a Navigation block set to either vertical or horizontal? Should this setting still be shown or should we just follow the orientation of the parent? |
This sounds pretty similar to the issues being tackled with the attempt to refactor the Gallery block to use nested Image blocks. There, the problem is how to handle controls like Image block width/height and alignment when the Image blocks are moved in/out of a Gallery block. I guess that whatever the proper solution is there should also apply here. |
Just had a thought about displaying child pages in dropdowns: if we're able to use the Pages block outside of a Navigation block, I'd expect it to work like the Categories block, and like the legacy Pages widget, and display a nested list instead. Could we perhaps make dropdowns optional for this block, as a setting? Or... open to ideas here 😅 |
The Pages block does not need to have a vertical/horizontal style. Instead, it should respect the settings of its parent block; The Navigation block should control the layout making the Pages block an invisible wrapper around a collection of Page blocks. (Related: #27324)
I think this is a similar situation to the layout control. On its own, the Pages block could render a normal ordered list using indentation to signify sub-lists. As a child of a Navigation block, the Pages block gains new "magic powers" and respects any options around the display of sub-menus and their indicators, as set by the parent Navigation block. |
A simple block that lists all your site's pages could be useful in a number of cases, including as a default block within the Navigation block (#23207). A Pages block would be (at first) restrictive and simple. It only does a few things:
You wouldn't be able to reorder, change page names, or otherwise make edits to the list of pages within the block content.
At some point we could...
Be sure to checkout the Figma file to see explorations for the above additions, along with a prototype for the essential shown in the GIF.
The text was updated successfully, but these errors were encountered: