Skip to content
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

Block Library: Add pagination to the Latest Posts block. #19969

Closed
wants to merge 1 commit into from

Conversation

epiqueras
Copy link
Contributor

Description

This PR adds basic single stepped pagination to the Latest Posts block posts list. In the future, we might want to look at adding more customization options.

How to test this?

Verify toggling pagination on enables pagination for the post list both in the editor and front end and that things work as expected. E.g. The previous link only renders if there is a previous page, and the next link only renders if there is a next page.

Screenshots

Screen Shot 2020-01-30 at 12 30 50 PM

Screen Shot 2020-01-30 at 12 30 38 PM

Types of Changes

New Feature: The Latest Posts block now supports pagination.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR.

@epiqueras epiqueras added [Type] Enhancement A suggestion for improvement. [Block] Latest Posts Affects the Latest Posts Block labels Jan 30, 2020
@epiqueras epiqueras added this to the Gutenberg 7.4 milestone Jan 30, 2020
@epiqueras epiqueras self-assigned this Jan 30, 2020
@youknowriad youknowriad removed this from the Gutenberg 7.4 milestone Feb 6, 2020
@mtias
Copy link
Member

mtias commented Feb 15, 2020

I am not sure about supporting this feature on this block at the current time due to how it coerces a server implementation that bypasses the natural template structure of a site into dealing with query vars. The demands for such a feature are largely due to the absence of queries (Query), which would address that fundamental issue and ideally connect with the relevant template resolution and query context. Supporting this preemptively in Latest Posts could signal a wrong preferred way of supporting blog pagination in general and color its adoption.

@epiqueras
Copy link
Contributor Author

I agree. I would much rather wait for the Query block and potentially deprecate this block. I just thought this feature was a more immediate need. I'll close it then.

@epiqueras epiqueras closed this Feb 15, 2020
@mtias
Copy link
Member

mtias commented Feb 15, 2020

I think there might still be some use cases for this in the block in the future, likely if we can pair it with a better handling on the front — maybe also a dynamic component on the front fetching from the API — but that's a whole different set of tradeoffs.

@epiqueras
Copy link
Contributor Author

epiqueras commented Feb 15, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Latest Posts Affects the Latest Posts Block [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants