Skip to content

Conversation

@dkotter
Copy link
Collaborator

@dkotter dkotter commented Dec 10, 2025

What?

Closes #11

This is a follow-up to #96, which added in the Excerpt Generation Experiment and Ability. This adds in the actual admin UI to trigger the generation.

Why?

Coming out of #96 you can manually trigger excerpt generation by hitting the proper API endpoint but there isn't an actual UI to run that. This PR adds in that UI, making it easy for editors to generate excerpts on-demand.

How?

  • Loads the proper assets when on the post edit screen
  • Uses the __experimentalPluginPostExcerpt slotfill to add a generate button below the excerpt form (note this slotfill is marked as deprecated but as far as I can tell, there isn't another solution right now)
  • Uses DOM manipulation to directly inject a generate button into the excerpt panel, as there isn't a slotfill or filter here to use
  • Both buttons are tied to the same functionality, which will trigger a request to generate an excerpt and then store that excerpt when returned (or show an error message if an error happens)

Testing Instructions

  1. Checkout this PR and run npm i && npm run build
  2. Ensure you have valid AI credentials set at Settings > AI Credentials
  3. Ensure you turn on the Excerpt Generation Experiment at Settings > AI Experiments
  4. Edit a content type that supports excerpts
  5. Within the excerpt panel, try generating an excerpt using both buttons and ensure it works

Screenshots or screencast

Excerpt generation button showing below the excerpt input Excerpt generation button showing next to the excerpt edit button in the editor panel

Test using WordPress Playground

The changes in this pull request can be previewed and tested using this WordPress Playground instance:

Click here to test this pull request.

Open WordPress Playground Preview

@dkotter dkotter added this to the 0.2.0 milestone Dec 10, 2025
@dkotter dkotter self-assigned this Dec 10, 2025
@github-actions
Copy link

github-actions bot commented Dec 10, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @nholzmann.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: nholzmann.

Co-authored-by: dkotter <[email protected]>
Co-authored-by: jeffpaul <[email protected]>
Co-authored-by: swissspidy <[email protected]>
Co-authored-by: Ref34t <[email protected]>
Co-authored-by: karmatosed <[email protected]>
Co-authored-by: jamesmorrison <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@codecov
Copy link

codecov bot commented Dec 10, 2025

Codecov Report

❌ Patch coverage is 0% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 46.27%. Comparing base (6478545) to head (feeb2cb).
⚠️ Report is 7 commits behind head on develop.

Files with missing lines Patch % Lines
...eriments/Excerpt_Generation/Excerpt_Generation.php 0.00% 17 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop     #143      +/-   ##
=============================================
- Coverage      46.89%   46.27%   -0.62%     
- Complexity       208      214       +6     
=============================================
  Files             19       19              
  Lines           1271     1288      +17     
=============================================
  Hits             596      596              
- Misses           675      692      +17     
Flag Coverage Δ
unit 46.27% <0.00%> (-0.62%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jeffpaul
Copy link
Member

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Excerpt Generation

2 participants