-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
The LatestPosts
block is one of the first blocks in Gutenberg and, also, one of the most important blocks for fast and easy full page building. This block has been iterated on from launch and in its current state can offer basic functionality for post listing pages.
@melchoyce outlined in #1594 the improvements which the LatestPosts
block needed in Jun 2017 and today, in February 2020, that list is almost complete - pending one exception: displaying featured images.
Given the past iteration plan is done and that in the past three years the block gathered new ideas I propose this issue as an overview issue for new features that can be added into a, let's call it, a LatestPosts
version 2.
This version 2 of LatestPosts
should include:
Implement theLatestPosts
block as a variation of theQuery
block (issue: [ Latest Posts ] Implement the LatestPosts block as a variation of the Query block #24521)Featured image support, in its own sidebar section (issue: Show Featured Images on the “Latest Posts” block #17472, pr: Add featured images to Latest Posts block #17151)- Featured image caption (see Homepage Articles by Newspack)
Featured image link (issue: [Latest Posts] Add link to featured image #21530, pr: Add option for adding link in featured image [ Latest Posts block ] #24548)- Whole block caption (see Homepage Articles by Newspack)
- More default block styles, especially needed once we add featured image (see Homepage Articles by Newspack)
Featured image alignment (see Homepage Articles by Newspack)Show author in posts (issue: Latest Posts Block: Option to show/hide the post author #17681, pr: Added ability to filter latest posts by author #16169)- Filter posts by tags and other taxonomies (issue: "Latest Posts" block should filter by Tag (and other taxonomies) #13027, PR - tags: Add tag selector to latest posts widget, add tag selector to queries #19755)
Filter posts by author (PR: Added ability to filter latest posts by author #16169)- Allow listing all CPTs, default to
post
(issue: Update Block: Latest Posts CPT #9013, PR: Add CPT selector to Latest Posts #20831) Multiple categories support PR: Adds multi-select to categories on Latest Posts #20781 (see Homepage Articles by Newspack)- Sort by comment number (issue: [Latest Posts] Add the ability to sort by comment numbers #22002)
August, 12, 2020 Edit: added on the list of tasks migrating the LP block to become a variation of the Query block.
There are a couple of things to keep in mind when developing for the LatestPosts
block, version 2:
-
With the advent of Full Site Editing there have been introduced a series of "Post Blocks", a set of blocks that can be used to describe and build a whole post in the context of a site page. These post blocks can be used to compose a full post and then display it in a loop.
The current implementation ofLatestPosts
uses custom HTML to create the post structure in the loop. Optionally, if development of theLatestPosts
version 2 takes a lot of time and the post blocks mature, we could implement the loop using these new blocks. -
The more filtering features we add to theLatestPosts
block the more it looks like aQuery
block, a block which doesn't exist yet but which could exist at some point (see issue: Query Panel Design / API (Latest Posts, Calendar, etc) #2662 and prs: Create Query Block #20106, Implemented query panel in latest posts block. #3198 taking the first steps in this direction).
This block would be a generalization of a block that can allow a user to visually customize aWP_Query
for a specific post loop, ideally offering all the options that WP_Query does. We can either end up with bothLatestPosts
andQuery
blocks and use them when appropriate, or we can, at some point in the future, evolveLatestPosts
into a more generic, all encompassing,Query
block.
Are you a new contributor?
This issue itself is big but it can, and will, be divided into smaller issues (some already exist). Trying to implement any of the missing features above is a great way to start contributing to Gutenberg with code. Also reviews of open PRs, suggestions and perspectives on open issues, are of great value as well. If you want to help but have questions, please leave a comment here so we can discuss what would be the best next step for you.
TL:DR;
Having a more feature complete LatestPosts
block is a priority for this year as it is a cornerstone of giving users easy control on post listings when working with Full Site Editing on their pages. Therefore jump in and let's build the best and most user friendly post listing block in the world!