sybrew / the-seo-framework

The SEO Framework WordPress plugin.
https://theseoframework.com/
GNU General Public License v3.0
418 stars 46 forks source link

Add WPGraphQL support #507

Open bonakor opened 4 years ago

bonakor commented 4 years ago

Hi, I'm seeing a lot of interest into the WpGraphQl approach (with Gatsby), and I'd love to know if you would think about adding support for it. I've seen for Yoast Seo (https://github.com/ashhitch/wp-graphql-yoast-seo) and would be glad having it for TSF :)

sybrew commented 4 years ago

I assume this would merely be an API to fetch database components without generating metadata?

That can easily be achieved with a fork from the linked project 😄

Mind that once #185 is implemented, the project needs an update. We can ensure forward compatibility using the get_post_meta_item()/get_post_meta() and get_term_meta_item()/get_term_meta() API from The SEO Framework, however.

LeBaux commented 4 years ago

I have seen the rising popularity of WPGraphQL myself, but my honest experience is there are not many themes built with Gatsby.js "yet". Merely tech demos, conference talks etc. Despite the 2k stars on GitHub, I wonder how many real users will utilize implementation to TSF.

On the other hand, TSF was and is known to be built with forward-thinking devs in mind and looking over that repo, it does not look like an extremely complicated "feature".

Can't say if it is worth an extension itself, but for it is another "marketing tech buzzword" we can use to promote TSF.

sybrew commented 4 years ago

Can't say if it is worth an extension itself, [...]

It is possible to detect WPGraphQL and register a type. So we can implement it via a "compat" file, so support is automatically added without the need for an extension.

add_action( 'graphql_register_types', function() {
    register_graphql_object_type(...);
    register_graphql_field(...);
} );
bonakor commented 4 years ago

Nice! And would we need to register eachfield and object type or it's possible to add it all at once?

sybrew commented 4 years ago

Looking at the implementation here, it seems we need to loop over each taxonomy and post type, and register the fields in bulk.

LeBaux commented 4 years ago

BTW I messaged you on Twitter (most convenient for me from social profiles you have on your website) with some additional details. Thank you for considering helping us with the translation!

bjoluc commented 2 years ago

I discovered https://github.com/findcanary/wp-graphql-the-seo-framework which works perfectly fine for my use cases – I'd love to have something along these lines included natively!

intelligence commented 2 years ago

Agreed, something native would be amazing. I tried using Yoast for a bit, but it's just too bloated.