ashhitch / wp-graphql-yoast-seo

This is an extension to the WPGraphQL plugin for Yoast SEO
GNU General Public License v3.0
216 stars 49 forks source link

Archive SEO enhancements #144

Closed rodrigo-arias closed 1 year ago

rodrigo-arias commented 1 year ago

This PR complementary of #85 makes the following improvements to the archive SEO data by using Yoast SEO surfaces.

While the API is well-documented for current pages, I didn't find a way to get the global values for individual pages. I'm also wondering if the archiveLink field should be renamed canonical.

Before

image

After

image

dushakov92 commented 1 year ago

@ashhitch this would be a very nice addition! i want this

ashhitch commented 1 year ago

Thanks for this, will look to get this merged. I just need to have a think as there is the breaking changes with the mapping of the placeholder values.

So may just be a major version bump 👍

ashhitch commented 1 year ago

@rodrigo-arias just been thinking for the noIndex noFollow fields these should be booleans, due to their naming. However, we can add extra fields to cover the explicit string versions. This way it will not be a breaking change, and I can always depreciate the old fields at some point.

Would it be more helpful to have a single field metaRobots that returned a string like noindex, nofollow

rodrigo-arias commented 1 year ago

@ashhitch I agree that when returning a string it makes more sense for the field names to be metaRobotsIndex and metaRobotsFollow, which are even the names that Yoast SEO gives them. However, I tried to keep it consistent with the base SEO fields.

See how we are returning strings even with those field names:

CleanShot 2022-12-07 at 11 56 35

Regarding having a single field, I think it would be a disadvantage since integrations with for example next-seo need those values separately.

If you still think it's better to register two new fields to avoid the breaking change, I can adjust it.

rodrigo-arias commented 1 year ago

@ashhitch have you had a chance to see my previous comment? Thanks

ashhitch commented 1 year ago

@rodrigo-arias sorry about the delay, lets go with the 2 new fields. thanks for helping out with this

rodrigo-arias commented 1 year ago

@ashhitch no worries, the new fields were added.

CleanShot 2022-12-26 at 21 33 20