Skip to content

Suite of Post Blocks #15623

Closed
Closed

Description

We currently offer a "latest posts" blocks with some configuration options which can be pretty nice for setting up homepages with some dynamic content arranged in different sort of grids and lists. There is also some ongoing work to include showing a featured image and the post excerpt as features than can toggled on the block settings.

However, it is clear such a block won't scale to offer all the flexibility that a proper post loop on a theme provides — it's not just showing elements (date, author, and so on) but also their positioning — nor the best editing experience either compared to more granular blocks.

What would be interesting is to explore a "Post" block that works as the wrapper for the post_ID context, and which contains an inner blocks area with several available child blocks:

  • Post Title
  • Post Author
  • Post Date
  • Post Excerpt
  • Featured Image
  • Post Content
  • Categories
  • Tags

This would allow displaying a "post" element in any context and with full flexibility.

wp:post { id: 1 }
    wp:post-title
    wp:featured-image
    wp:post-excerpt

Furthermore, this block can support templates, so on insertion it can offer a few defaults (just post title, post title and excerpt, featured image to the side, etc).

Starting with a single post would allow us to determine how the child blocks should be structured. By having each element be a child block, we can also expand on the configuration options much more elegantly: the date format display would be easier to connect, the excerpt can offer to customize the number of words and the trailing cutoff, the image can have specific settings, and so on.

If this proves convenient, we can then look at a more general purpose Query block that would allow to control the query parameters and then use the "post" block for display. This could be super useful for themes to build sophisticated static pages with dynamic content but full control over layout and content.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    CustomizationIssues related to Phase 2: Customization effortsNew BlockSuggestion for a new block

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions