Gutenberg: Query: Number of pages settings are too restrictive

Created on 28 Oct 2020  Â·  5Comments  Â·  Source: WordPress/gutenberg

Problem

Currently, the "Number of pages" control requires the user to set the exact number of pages they want to include in the query.

Screen Shot 2020-10-28 at 11 47 24 AM

This is a problem because many times the user might want to include _all_ posts that match their settings and may not know the exact number they need to type as the page count.

Solution

I realize that the Pagination block should be one the user can add, duplicate, and move around (hopefully from within the Query block). But the setting should be a simple toggle to turn on or off pagination, not an input field. Maybe in the block itself, a user can adjust whether or not they want "All" pages or limit this by a particular number.

Can we try something like this?

pagination

I also imagine the Pagination block would provide the same options as other blocks such as "Duplicate" allowing more than one Pagination block and moving it to above or below the list.

Screen Shot 2020-10-28 at 12 35 06 PM

cc @ntsekouras @mariohamann

Needs Dev Needs Technical Feedback [Block] Query

All 5 comments

  • I wasn't aware of the concept of "Number of pages". In my opinion, this option doesn't make sense. Is this option still available? In the loooong discussion in https://github.com/WordPress/gutenberg/issues/25198#issue-697086719 it seemed to be abandoned very early? (Is this option available in REST?)
  • I totally second the idea that the pagination block should be inside the Query Block – I think that makes things easier in technical terms.
  • I like the interaction to add a pagination Block and I like the concept of adding more than one pagination block. Instead of a Boolean: What do you think about an "Add button"? I think in that case we could add a pagination block per default (Currently it would feel strange to have pagination active per default, but in FSE it would be quite useful.) Edit: This interaction could make a lot of sense: In the current flow the Pagination block is just gone if a user deletes it – but the pagination option is still active. So one would have to switch pagination off and switch pagination on again to get the pagination block back? I think a simple "add pagination" button which creates the default block and makes pagination possible could be handier in the long run.

Screen Recording 2020-10-28 at 21 45 56

Further thoughts

  • Will pagination be available outside of FSE? That wouldn't work, would it?
  • To show the Top 10 of posts, users would select "10 posts per page" and "No pagination". Quick thought concerning the labels: Might it the label "posts per page" irritate if there is only one page?

Thanks, @mariohamann!

I like the interaction to add a pagination Block and I like the concept of adding more than one pagination block. Instead of a Boolean: What do you think about an "Add button"?

I believe the Inserter (panel and/or inline) would solve this. Here's a screenshot of how it is right now.

Screen Shot 2020-10-29 at 11 13 54 AM

The initial idea behind the toggle in the toolbar was about turning pagination on... not so much around adding pagination, although it did that as well. :)

I did receive some feedback today from @jameskoster and @MichaelArestad about including the Pagination block in the Query block by default. And if the user doesn't want it, they can just delete that block. Here's how that might work.

pagination

Could we remove the number of pages setting? This seems like information that should be passed to the pagination block somehow without a user needing to specify.

Isn't the Number of pages setting is entirely redundant?

I'd have thought it would be calculated automatically – total number of posts returned by query / number of posts displayed per page = number of pages

@ntsekouras can we get to this point where the Pagination block is added by default to the Query block? And then if we can revise the dropdown to look more like this:

  • Eliminate the "number of pages" option.
  • Add helper text to the "offset" option along with a more thorough label.

Screen Shot 2020-11-03 at 10 33 48 AM

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aaronjorbin picture aaronjorbin  Â·  3Comments

spocke picture spocke  Â·  3Comments

maddisondesigns picture maddisondesigns  Â·  3Comments

franz-josef-kaiser picture franz-josef-kaiser  Â·  3Comments

wpalchemist picture wpalchemist  Â·  3Comments