-
Notifications
You must be signed in to change notification settings - Fork 914
Create API endpoints for SEO and readability scores #21847
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By 8000 clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
thijsoo
merged 27 commits into
feature/dash-phase-1
from
529-create-api-endpoint-for-readability-scores
Nov 25, 2024
Merged
Create API endpoints for SEO and readability scores #21847
thijsoo
merged 27 commits into
feature/dash-phase-1
from
529-create-api-endpoint-for-readability-scores
Nov 25, 2024
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…-the-seoreadability-score
…er of the given content type
thijsoo
requested changes
Nov 21, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CR 🚧
src/dashboard/application/content-types/content-types-repository.php
Outdated
Show resolved
Hide resolved
src/dashboard/application/scores/readability-scores/readability-scores-repository.php
Outdated
Show resolved
Hide resolved
18 tasks
42a613d
to
4c786a5
Compare
thijsoo
approved these changes
Nov 25, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CR + ACC 👍
18 tasks
This was referenced Nov 27, 2024
18 tasks
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
Summary
This PR can be summarized in the following changelog entry:
Relevant technical choices:
wpseo_{$content_type}_filtering_taxonomy
filter or because it's a hardoced filtering pair, described in this PR)query_var
, there will be noView
URLs returned, because there can't be a URL that filters the CPT page on that taxonomy. In those cases, we will have noView
buttons in the UITest instructions
Test instructions for the acceptance test before the PR gets merged
This PR can be acceptance tested by following these steps:
Note: We're going to use POSTMAN to test the API endpoint, so use this post to learn how to authenticate.
For posts and categories:
primary_focus_keyword_score
, to have a view on what to expect/wp-json/yoast/v1/seo_scores?contentType=post
and confirm that you get a response similar to the below, with the amounts representing what you have in the database:primary_focus_keyword_score
over 70, 1 post withprimary_focus_keyword_score
between 41 and 70, 2 posts with under 40 and 1 post without keyphrase.primary_focus_keyword_score
over 70 into a draft and repeat the request -> you should get one lessamount
in thegood
object.primary_focus_keyword_score
over 70 into anoindexed
post and repeat the request -> you should get one lessamount
in thegood
object and when visiting the link you get the same amount of posts in the filtered posts page. - Note: there's no need to do that for readability scores/wp-json/yoast/v1/seo_scores?contentType=post&taxonomy=category&term=<TERM_ID>
(replaceTERM_ID
with the correct term ID)/wp-json/yoast/v1/seo_scores?contentType=product&taxonomy=product_cat&term=<TERM_ID>
- pay extra focus on the links to confirm that they get you to the right filtered state in the products page/wp-json/yoast/v1/seo_scores?contentType=<CPT_NAME>&taxonomy=<TAX_NAME>&term=<TERM_ID>
- pay extra focus on the links to confirm that they get you to the right filtered state in the CPT pageAdded filter via hook, for a taxonomy with custom REST API URL
in order to be able to create a CPT and connect it to a filtering taxonomy.For when SEO scores are at the end of the ranges:
40
,41
,70
,71
, to make sure they are categorized asbad
,ok
,ok
andgood
respectivelyprimary_focus_keyword
to to40
,41
,70
,71
._yoast_wpseo_linkdex
column to the same/wp-json/yoast/v1/seo_scores?contentType=post
and when you click on each score's link, confirm that you get the same amount of posts with theamount
attribute of each post.For when the post type requested is excluded from indexable creation:
/wp-json/yoast/v1/seo_scores?contentType=page
Invalid content type
error.For when the term requested is not part of the taxonomy:
/wp-json/yoast/v1/seo_scores?contentType=post&taxonomy=category&term=<TERM_ID>
(replaceTERM_ID
with an ID that doesn't exist in terms)Invalid term
error.For a custom taxonomy that doesn't have links because it has a false
query_var
:query_var
attribute and assign it to books:/wp-json/yoast/v1/seo_scores?contentType=book&taxonomy=alternative-genre&term=<TERM_ID>
(replaceTERM_ID
with the correct term ID)Invalid taxonomy
erroralternative-genre
taxonomy as filter for books and repeat the GET request:1
):links
attributes - In those cases, we will have noView
buttons in the UI.For when Yoast SEO is not enabled and a post is created:
not analyzed
oneReadability scores:
Needs improvement
/bad
scores. Posts that have never been saved from the editor once, they are consideredNot analyzed
/wp-json/yoast/v1/readability_scores?contentType=
instead of/wp-json/yoast/v1/seo_scores?contentType=
For when SEO scores are at the end of the ranges
, we have to change thereadability_score
column in the indexable table and the_yoast_wpseo_content_score
column in the postmeta tablenoindexed
posts (the relevant step is already mentioning that, so you can ignore it)Relevant test scenarios
Test instructions for QA when the code is in the RC
Impact check
This PR affects the following parts of the plugin, which may require extra testing:
UI changes
Other environments
[shopify-seo]
, added test instructions for Shopify and attached theShopify
label to this PR.Documentation
Quality assurance
Innovation
innovation
label.Fixes https://github.com/Yoast/roadmap/issues/529