Since version 14.0, Yoast added a REST API field where it shows the head tags needed for SEO purposes, so it’d be great to have a package similar to
@frontity/head-tags that fetch the head tags from Yoast field instead of from our plugin.
This way, Yoast team would take care of the REST API support (as they are already doing) and we just have to take care of adapting that info for Frontity with this package.
With this solution, if you use Yoast ^14.0 (the version where they added the REST API support), you could use
@frontity/yoast package and, if you use an older version of the plugin, or any other plugin without API support, you can use the Head Tags plugin &
Although the Head Tags plugin is working great, users have to install another plugin, so this would mean one plugin less, just with Yoast is enough.
This package could be pretty similar to the
@frontity/head-tags package, as it’s going to do the same, but getting the info that the Yoast plugin is showing in the REST API.
We had another conversation about how it works at this topic. The Yoast plugin is adding a new field to the REST API named
yoast_head , which is a string of all the meta tags (it’s similar to what we’re doing with the REST API Head Tags plugin , but we are adding an array instead of a string). This way, if you go to a post, a category, a tag, etc, in the REST API, you can find this new field with all the meta tag of the specific entity. So if I go to
https://myweb.com/wp-json/wp/v2/posts?slug=my-post , I can find this string:
Apart from this, in the WordPress side, we would need to add the
types endpoint to
embeddable: true to make sure that information is retrieved in a single fetch when you request a post-type archive using
?_embed=true . This how we do it in the head-tags plugin. The Yoast team has opened this ticket to add it to WordPress core, but we could add it manually meanwhile or in the future Frontity plugin.