Skip to content

Tracking issue for further block editor and full site editing support #940

@douglas-johnson

Description

@douglas-johnson

Continued from #932 cc @alecgeatches

Goal

Improve support for the block editor and full site editing by providing blocks to handle two use cases:

  1. Display one or more coauthors in a templated manner within post contexts and query loops.
  2. Display the queried coauthor in author archive contexts.

Features

Blocks

  • Author Template
    • A repeating pattern that displays multiple coauthors, similar to Post Template within a query loop.
    • Wraps around the other blocks listed below to provide them context.
  • Author Name
    • Choose between Display Name, First Name, Last Name
    • Optionally wrapped a link.
  • Author Avatar
    • Optionally wrapped in a link.
  • Author Description

Block Editor

  • Add coauthors to post content.
  • Add coauthors to query loops.
  • Subscribe to existing CAP store so that a change to the assigned coauthors is reflected in the content.
  • Support appearance tools.

Full Site Editing

  • Add coauthors to post templates outside of content.
  • Add coauthor data to author archives using an All Authors template type.

Layouts

  • Support the following in the Author Template block
    • Separators between authors and a distinct separator for the last author.
    • An inline layout typical of bylines.
    • A block layout typical of end of article author card.

Extensibility

  • Support the addition of fields in the API.
    • Should fields be added using coauthors_guest_author_fields or should it go through the REST API framework?
  • Support the ability for others to make custom blocks that work in the Author Template block.

Features in consideration for future versions

  • Is it possible to output a Social Icons block and fill it with a coauthor's social links?
  • Support more layout options based on user feedback, a grid of cards for example.
  • How might we support templates for specific authors in Full Site Editing?

Approach

API

Create two API endpoints intended to GET coauthor data.

GET CoAuthors by :post-id

Use Case

  • Query for the coauthors of a post in post or post template contexts.

Request

  • Require :post-id in URL

Response

  • Array of CoAuthor objects

Authorization

  • Intended for editors and up, but to be determined by capability check.
  • Plus anyone who is a coauthor of the post in question.

GET CoAuthor by :author-name

Use Case

  • When rendering a block for a specific coauthor, query for them.
  • (future) When editing an author archive template, query for single coauthor.

Request

  • Require :author-name in URL.
    • Author term slug without the cap- prefix, same as author_name query_var available in author archive requests.

Response

  • Single CoAuthor object

Authorization

  • To be determined based on more information from testing full site editing.

CoAuthor Objects in API Responses

These objects should have the same shape as the objects returned by get_coauthors(), with some notable exceptions.

  • Author archive URLs should be included.
  • Author avatar attachment ids should be included if available.
    • Should handle Gravatar as well.

Developer Experience

Use wp-scripts with the ability to run a single build command for all blocks and scripts in CAP.

Compatibility considerations

Metadata

Metadata

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions