Skip to content

feat(content-loop): support custom bylines#2105

Merged
miguelpeixe merged 4 commits into
trunkfrom
feat/custom-bylines-support
Apr 15, 2025
Merged

feat(content-loop): support custom bylines#2105
miguelpeixe merged 4 commits into
trunkfrom
feat/custom-bylines-support

Conversation

@miguelpeixe

@miguelpeixe miguelpeixe commented Apr 11, 2025

Copy link
Copy Markdown
Member

All Submissions:

Changes proposed in this Pull Request:

Implement custom byline support to the Content Loop block.

This PR also refactors how avatars and bylines are rendered in the editor for the Content Loop and Carousel blocks. It unifies the rendering strategy, passing the full markup instead of author data for react parsing. The single strategy improves extensibility and maintainability.

Supersedes #2091

How to test the changes in this Pull Request:

  1. Checkout feat(bylines): get post byline authors newspack-plugin#3911
  2. Create a new category and publish 4 posts in this category with the following author setup:
    1. Single author with a custom byline
    2. 3 authors without custom byline
    3. 3 authors with a custom byline that only mentions 2 of them
    4. 3 authors with a custom byline but toggled off
  3. Draft a new page and add a Content Loop block
  4. Filter the block by the created category and confirm the bylines rendered as expected in the editor
  5. Publish and visit the page
  6. Confirm the bylines reflect the editor

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@miguelpeixe miguelpeixe changed the title feat: support custom bylines feat(content-loop): support custom bylines Apr 11, 2025
@miguelpeixe miguelpeixe marked this pull request as ready for review April 11, 2025 18:53
@miguelpeixe miguelpeixe requested a review from a team as a code owner April 11, 2025 18:53
@miguelpeixe miguelpeixe self-assigned this Apr 11, 2025

@leogermani leogermani left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When using the custom byline, the post date sticks together with the last author name

image

In this branch, the Carousel block throws an error.

Question: Looking at the code I wonder if we should offer a filter, instead of calling the Bylines method directly... something like we did in the theme -> https://github.com/Automattic/newspack-theme/blob/trunk/newspack-theme/inc/template-tags.php#L92

@miguelpeixe

Copy link
Copy Markdown
Member Author

I got into a bit of a rabbit hole looking into implementing filters and decided to refactor how the editor renders the avatars and bylines.

Filters weren't practical before this refactor because the editor doesn't use the markup used in the view. It should now be unified and filterable, which is simpler and better to maintain.

@miguelpeixe miguelpeixe requested a review from leogermani April 15, 2025 15:40
@miguelpeixe miguelpeixe merged commit 6f70449 into trunk Apr 15, 2025
@miguelpeixe miguelpeixe deleted the feat/custom-bylines-support branch April 15, 2025 16:59
@github-actions

Copy link
Copy Markdown

Hey @miguelpeixe, good job getting this PR merged! 🎉

Now, the needs-changelog label has been added to it.

Please check if this PR needs to be included in the "Upcoming Changes" and "Release Notes" doc. If it doesn't, simply remove the label.

If it does, please add an entry to our shared document, with screenshots and testing instructions if applicable, then remove the label.

Thank you! ❤️

matticbot pushed a commit that referenced this pull request Apr 23, 2025
# [4.11.0-alpha.1](v4.10.1...v4.11.0-alpha.1) (2025-04-23)

### Bug Fixes

* adjust cache handling for feeds ([#2112](#2112)) ([f880061](f880061))
* update how we check for the express checkout in the is_modal check ([#2109](#2109)) ([652daf7](652daf7))

### Features

* add body class depending on theme type ([#2101](#2101)) ([efcda76](efcda76))
* **content-loop:** support custom bylines ([#2105](#2105)) ([6f70449](6f70449))
* **wcsg:** respect checkbox label option in WCSG settings ([#2053](#2053)) ([58e40c5](58e40c5))
@matticbot

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 4.11.0-alpha.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

matticbot pushed a commit that referenced this pull request May 8, 2025
# [4.12.0-alpha.1](v4.11.0...v4.12.0-alpha.1) (2025-05-08)

### Bug Fixes

* adjust cache handling for feeds ([#2112](#2112)) ([f880061](f880061))
* update how we check for the express checkout in the is_modal check ([#2109](#2109)) ([652daf7](652daf7))

### Features

* add body class depending on theme type ([#2101](#2101)) ([efcda76](efcda76))
* **content-loop:** support custom bylines ([#2105](#2105)) ([6f70449](6f70449))
* **wcsg:** respect checkbox label option in WCSG settings ([#2053](#2053)) ([58e40c5](58e40c5))
@matticbot

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 4.12.0-alpha.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

matticbot pushed a commit that referenced this pull request May 14, 2025
# [4.12.0](v4.11.0...v4.12.0) (2025-05-14)

### Bug Fixes

* adjust cache handling for feeds ([#2112](#2112)) ([f880061](f880061))
* update how we check for the express checkout in the is_modal check ([#2109](#2109)) ([652daf7](652daf7))

### Features

* add body class depending on theme type ([#2101](#2101)) ([efcda76](efcda76))
* **content-loop:** support custom bylines ([#2105](#2105)) ([6f70449](6f70449))
* **wcsg:** respect checkbox label option in WCSG settings ([#2053](#2053)) ([58e40c5](58e40c5))
@matticbot

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 4.12.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants