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

Update openGraph frontPage support #129

Closed BronsonQuick closed 2 years ago

BronsonQuick commented 2 years ago

Hey @ashhitch, firstly, thanks so much for writing and maintaining this plugin. I've used it on a couple of headless WordPress projects now and it's saved me loads of time!

I've just been digging into a few things with the frontPage support you've added and I found a few bugs and improvements that we can add:

  1. I noticed that placeholders that Yoast use weren't getting parsed so I've wrapped one of your functions so that's handled.
  2. I noticed that Yoast SEO deprecated the keys for the OG front page options so I've updated those. N.B. The og_default_image_id key in defaultImage remains though.

Screenshots

Before Any Changes

GraphiQL_IDE__WPGraphQL_Chassis_Site_Title__WordPress_2022-03-15_12-53-38 (1)

After changing keys but before adding wpseo_replace_vars

GraphiQL_IDE__WPGraphQL_Chassis_Site_Title__WordPress_2022-03-15_12-56-08

After All The Changes

GraphiQL_IDE__WPGraphQL_Chassis_Site_Title__WordPress_2022-03-15_12-52-01
ashhitch commented 2 years ago

@BronsonQuick thank you for taking the time to put this PR together, especially the examples! one quick question as wp_gql_seo_format_string is used in a few places and I see you are passing the arg of post to wpseo_replace_vars. Wondering if this is safe for taxonomies and custom post types?

BronsonQuick commented 2 years ago

Hey @ashhitch, good catch Sir! I hadn't thought to try it on other post types and taxonomies. I'll update this PR in a couple of hours when I clock on for the day and pass in an array of built in post types, taxonomies and the registered CPTs as well and test it out.

BronsonQuick commented 2 years ago

@ashhitch Sorry for not getting back to this the other day. I've just updated the PR for you now and I've tested it still works as expected.

GraphiQL_IDE__WPGraphQL_Chassis_Site_Title__WordPress_2022-03-24_18-43-47
ashhitch commented 2 years ago

@BronsonQuick hope you don't mind but i made a couple of tweaks to just apply replace vars to fields that require it for performance.

BronsonQuick commented 2 years ago

@ashhitch No worries at all. I didn't have too much time at work to dig right into it at a lower level. Thanks for merging it in!

Also, would you be interested in me doing a PR so that the plugin meets WordPress coding standards? We're running it on a WordPress VIP site so it'd be nice for me to get the plugin passing it's coding standards. It'd mostly be whitespace fixes for tabs, spacing and alignments.