Skip to content

Search 3.0: add author to expanded results-list meta row (RSM-2999)#48751

Merged
kangzj merged 3 commits into
trunkfrom
nova/rsm-2999-author-expanded-layout
May 13, 2026
Merged

Search 3.0: add author to expanded results-list meta row (RSM-2999)#48751
kangzj merged 3 commits into
trunkfrom
nova/rsm-2999-author-expanded-layout

Conversation

@kangzj
Copy link
Copy Markdown
Contributor

@kangzj kangzj commented May 13, 2026

Fixes RSM-2999

Why

Authors are a primary signal readers use to decide which result to click. Legacy Instant Search shows the post author in its expanded result card; Search 3.0's expanded jetpack-search/results-list block had dropped it. This PR brings that information back so site visitors and editors who migrate from Instant Search don't lose a familiar piece of context.

Proposed changes

  • Normalize fields.author from the v1.3 Search API into a single authorLabel on each result. Single-author posts pass through as-is; co-authored posts comma-join (Instant Search's behaviour), and >3 authors truncate to the first three + "..." so the meta row doesn't run away.
  • Add a show_author per-layout flag, enabled for the expanded layout only (compact and product unchanged).
  • Render the author in the same .jetpack-search-results__meta row that holds the date — author first, then a · separator span, then the date. The separator is bound to data-wp-bind--hidden="!authorLabel || !dateLabel" so posts with only an author or only a date don't get a stray bullet.
  • Mirror the markup in the editor preview (edit.js → renderExpandedPreview) so Gutenberg authors see the field in the inserter, including the multi-author and no-author edge cases.
  • Restyle .jetpack-search-results__meta as a flex row with a 0.5rem gap and move the meta row's top margin off of the date span so the new author span doesn't get a stale top offset. Compact layout keeps its inline-with-title behaviour via a margin-top: 0 override.

Related product discussion/links

Does this pull request change what data or activity we track or use?

No.

Screenshots

Editor preview of the jetpack-search/results-list block in Expanded layout, captured locally via Playwright against the per-agent docker WordPress at 1440×900.

Before (trunk) After
before after

Notice the third sample row in the After image — it intentionally has no author, and the · separator is suppressed.

Testing instructions

Acceptance criteria from RSM-2999, in checklist form:

  • In a post/page containing a jetpack-search/results-list block in Expanded layout, a result with a single author shows that author in the meta row, before the date, separated by a ·.
  • A result with co-authors (2 or 3) shows their names comma-joined in the same meta row.
  • A result with more than 3 co-authors shows the first three joined with commas and a trailing "..." (e.g. Ada, Bob, Cris...).
  • A result with no author renders only the date — no stray · separator and no empty author span.
  • Compact and Product layouts are unchanged (author is suppressed; meta row visual matches trunk).
  • In the block editor, opening the Inserter preview for the Expanded layout shows the same author treatment via the sample data (Sample Author, A. Writer, B. Editor, and an author-less third row).

@kangzj kangzj added [Status] Needs Review This PR is ready for review. [Feature] Search For all things related to Search [Plugin] Search A plugin to add an instant search modal to your site to help visitors find content faster. [Package] Search Contains core Search functionality for Jetpack and Search plugins labels May 13, 2026
@kangzj kangzj self-assigned this May 13, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 13, 2026

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the nova/rsm-2999-author-expanded-layout branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack nova/rsm-2999-author-expanded-layout

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions
Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Search plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@kangzj kangzj added [Status] In Progress and removed [Status] Needs Review This PR is ready for review. labels May 13, 2026
@kangzj kangzj marked this pull request as draft May 13, 2026 00:18
@kangzj kangzj requested a review from Copilot May 13, 2026 00:18
@kangzj

This comment has been minimized.

@claude

This comment has been minimized.

This comment was marked as outdated.

@jp-launch-control
Copy link
Copy Markdown

jp-launch-control Bot commented May 13, 2026

Code Coverage Summary

Coverage changed in 2 files.

File Coverage Δ% Δ Uncovered
projects/packages/search/src/search-blocks/blocks/results-list/render.php 270/270 (100.00%) 0.00% 0 💚
projects/packages/search/src/search-blocks/store/result-utils.js 116/116 (100.00%) 0.00% 0 💚

Full summary · PHP report · JS report

…matAuthor (comments #3230642237, claude[bot] review)
@kangzj

This comment has been minimized.

@kangzj

This comment has been minimized.

@kangzj

This comment has been minimized.

@claude

This comment has been minimized.

This comment has been minimized.

Copilot finished work on behalf of kangzj May 13, 2026 00:36
@kangzj

This comment has been minimized.

@kangzj

This comment has been minimized.

@kangzj

This comment has been minimized.

@claude

This comment has been minimized.

This comment has been minimized.

Copilot finished work on behalf of kangzj May 13, 2026 00:50
@kangzj
Copy link
Copy Markdown
Contributor Author

kangzj commented May 13, 2026

🤖 Review-cycle summary — 123a57db22a88cbc2a1be5

4 round(s); CI green; 1 thread resolved; 2 AI reviewers (Copilot + claude[bot]) addressed.

What changed during the cycle

Commits added:

  • 44cd5c6c664 — Address review: request author from API + decode HTML entities in formatAuthor (comments #3230642237, claude[bot] review)
  • 88cbc2a1be5 — Address review: fix stale test fixture + name for authorLabel exposure (claude[bot] re-review)

Diff summary: 4 files changed, 29 insertions(+), 8 deletions(-)

Review threads addressed:

Source Comment Resolution
Copilot (inline) result-utils.js:445authorLabel derived but author wasn't in SEARCH_FIELDS, so it would always be empty at runtime. Added 'author' to SEARCH_FIELDS; flipped the api.test.js assertion to require it. Resolved in 44cd5c6c664.
claude[bot] (review) formatAuthor doesn't call decodeEntities; names like O’Brien would render literally via data-wp-text. Wired both string and array paths through decodeEntities; added a test case for numeric/named entity coverage. Resolved in 44cd5c6c664.
claude[bot] (re-review) Stale test at result-utils.test.js:699 had a dotted fixture ('author.name') and a name that read as a prohibition of behavior the PR now provides. Renamed test, swapped fixture to the real author field, added explicit authorLabel === 'Ada Lovelace' assertion. Resolved in 88cbc2a1be5.

Unaddressed (flagged for owner): None.

CI: all required checks passing.

@kangzj kangzj added [Status] Needs Team Review Obsolete. Use Needs Review instead. and removed [Status] In Progress labels May 13, 2026
@kangzj kangzj marked this pull request as ready for review May 13, 2026 01:16
@kangzj kangzj merged commit d48af95 into trunk May 13, 2026
102 of 105 checks passed
@kangzj kangzj deleted the nova/rsm-2999-author-expanded-layout branch May 13, 2026 01:34
@github-actions github-actions Bot added [Status] UI Changes Add this to PRs that change the UI so documentation can be updated. and removed [Status] In Progress [Status] Needs Team Review Obsolete. Use Needs Review instead. labels May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Search For all things related to Search [Package] Search Contains core Search functionality for Jetpack and Search plugins [Plugin] Search A plugin to add an instant search modal to your site to help visitors find content faster. [Status] UI Changes Add this to PRs that change the UI so documentation can be updated. [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants