Skip to content

Create new endpoint for getting available pages to be manually selected for llms.txt#22400

Merged
thijsoo merged 6 commits intofeature/llms-txt-phase-2from
657-use-indexables-table-for-populating-the-available-pages-list-for-manual-selection
Jul 8, 2025
Merged

Create new endpoint for getting available pages to be manually selected for llms.txt#22400
thijsoo merged 6 commits intofeature/llms-txt-phase-2from
657-use-indexables-table-for-populating-the-available-pages-list-for-manual-selection

Conversation

@leonidasmi
Copy link
Copy Markdown
Contributor

@leonidasmi leonidasmi commented Jul 4, 2025

Context

Summary

This PR can be summarized in the following changelog entry:

  • Uses indexables for populating the dropdowns for the manual page selection in llms.txt.

Relevant technical choices:

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • Confirm you have indexables enabled and the SEO optimization completed
  • Go to yoast settings->llms.txt
  • Click on a dropdown and confirm that you see the 10 most recently modified public pages to select.
  • If you write something in the dropdown, confirm that you see the pages that are properly filtered by what you wrote. The thing you wrote filters page titles.
  • Select one page, save, refresh and confirm that it persists
  • From the 10 most recently modified public pages that you saw in the previous steps, change some of them likeso:
    • Make one private
    • Make one draft
    • Make one scheduled
    • Make one noindexed
    • Make one password-protected
  • Revisit the llms.txt settings page and this time when you click on a dropdown you see again the 10 most recently modified pages, but you won't see the ones you edited in the previous step
  • Repeat the above tests, for when you have reset and disabled indexables. (the only difference is that the noindexed page will still appear in the dropdown.

Error handling:

  • You have to use POSTMAN for this, as there's no easy way to trigger an error here
    • As usual, use this post, to be able to authenticate your request there
  • Do a GET request to /wp-json/yoast/v1/available_posts and confirm you get data for pages
  • Do a GET request to /wp-json/yoast/v1/available_posts?postType=post and confirm you get data for posts
  • Do a GET request to /wp-json/yoast/v1/available_posts?postType=NOT_VALID_POST_TYPE and confirm you get a 400 response with the "error": "The post type asked is not valid" body

Relevant test scenarios

  • Changes should be tested with the browser console open
  • Changes should be tested on different posts/pages/taxonomies/custom post types/custom taxonomies
  • Changes should be tested on different editors (Default Block/Gutenberg/Classic/Elementor/other)
  • Changes should be tested on different browsers
  • Changes should be tested on multisite

Test instructions for QA when the code is in the RC

  • QA should use the same steps as above.

QA can test this PR by following these steps:

Impact check

This PR affects the following parts of the plugin, which may require extra testing:

  • With indexables both enabled and disabled (and reset), confirm that llms.txt file stays the same both with this RC/PR and without.

UI changes

  • This PR changes the UI in the plugin. I have added the 'UI change' label to this PR.

Other environments

  • This PR also affects Shopify. I have added a changelog entry starting with [shopify-seo], added test instructions for Shopify and attached the Shopify label to this PR.

Documentation

  • I have written documentation for this change. For example, comments in the Relevant technical choices, comments in the code, documentation on Confluence / shared Google Drive / Yoast developer portal, or other.

Quality assurance

  • I have tested this code to the best of my abilities.
  • During testing, I had activated all plugins that Yoast SEO provides integrations for.
  • I have added unit tests to verify the code works as intended.
  • If any part of the code is behind a feature flag, my test instructions also cover cases where the feature flag is switched off.
  • I have written this PR in accordance with my team's definition of done.
  • I have checked that the base branch is correctly set.

Innovation

  • No innovation project is applicable for this PR.
  • This PR falls under an innovation project. I have attached the innovation label.
  • I have added my hours to the WBSO document.

Fixes #

@leonidasmi leonidasmi added this to the feature/llms-txt-phase-2 milestone Jul 4, 2025
@leonidasmi leonidasmi added the changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog label Jul 4, 2025
@leonidasmi leonidasmi changed the title Create new endpoint for getting available pages to be manually select… Create new endpoint for getting available pages to be manually selected for llms.txt Jul 7, 2025
@coveralls
Copy link
Copy Markdown

coveralls commented Jul 7, 2025

Pull Request Test Coverage Report for Build df3ee4c37827f5029be50fd71f4b65ab2e8cd5eb

Details

  • 9 of 109 (8.26%) changed or added relevant lines in 10 files are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.4%) to 53.618%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/repositories/indexable-repository.php 2 3 66.67%
src/llms-txt/domain/available-posts/invalid-post-type-exception.php 0 2 0.0%
src/conditionals/llms-txt-enabled-conditional.php 0 4 0.0%
src/llms-txt/infrastructure/content/automatic-post-collection.php 5 9 55.56%
src/llms-txt/domain/content-types/content-type-entry.php 2 8 25.0%
src/llms-txt/domain/available-posts/data-provider/parameters.php 0 7 0.0%
src/llms-txt/application/available-posts/available-posts-repository.php 0 8 0.0%
src/llms-txt/domain/available-posts/data-provider/available-posts-data.php 0 8 0.0%
src/llms-txt/domain/available-posts/data-provider/data-container.php 0 11 0.0%
src/llms-txt/user-interface/available-posts-route.php 0 49 0.0%
Files with Coverage Reduction New Missed Lines %
src/llms-txt/domain/content-types/content-type-entry.php 2 37.5%
Totals Coverage Status
Change from base Build 3345d606d20f13b8d77cb46181044002eb00136e: 0.4%
Covered Lines: 30493
Relevant Lines: 57870

💛 - Coveralls

@leonidasmi leonidasmi marked this pull request as ready for review July 7, 2025 10:48
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jul 7, 2025

A merge conflict has been detected for the proposed code changes in this PR. Please resolve the conflict by either rebasing the PR or merging in changes from the base branch.

Copy link
Copy Markdown
Contributor

@thijsoo thijsoo left a comment

Choose a reason for hiding this comment

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

CR + ACC 👍

One thing I did notice is that the get pages request is fired everytime you hit the page. Which we will solve in a different issue

@thijsoo thijsoo merged commit 19fd459 into feature/llms-txt-phase-2 Jul 8, 2025
39 checks passed
@thijsoo thijsoo deleted the 657-use-indexables-table-for-populating-the-available-pages-list-for-manual-selection branch July 8, 2025 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants