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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Adds an optional
seovalue to thefieldsparam on the/fuxt/v1/postand/fuxt/v1/postsendpoints. When requested (e.g.?uri=/home/&fields=acf,seo), the response includes the full Yoast SEO meta payload for the post — title, description, robots, canonical, all Open Graph and Twitter tags, article timestamps, and the complete JSON-LD schema graph.Why
Our fuxt endpoints build responses with custom callbacks rather than WP core REST controllers, so Yoast's automatic
yoast_head_jsonfield never appears on them. This exposes the same data through the existingfieldspattern, letting headless frontends render full SEO head tags from the single page fetch they already make.How
Post::get_postdata()gains aseoblock that calls Yoast's surface API:YoastSEO()->meta->for_post( $id )->get_head()->jsonfunction_exists( 'YoastSEO' )— returnsseo: nullwhen Yoast isn't active, so this is safe on sites without the pluginseois not inherited bychildren/siblings/next/prevsub-posts, to keep list responses leanfieldsenum, allowed-fields list, and item schema on both controllersTwo payload adjustments for headless clients that camelCase response keys:
schemais shipped as a JSON string (not an object) so JSON-LD keys like@context/@graphsurvive client-side key transforms — inject it directly into a<script type="application/ld+json">tagtwitter_miscis dropped (keyed by human-readable labels, which key transforms would mangle)Frontend reference
The corresponding Nuxt consumption pattern lives on the freshman-year frontend's
yoast-seobranch: a prop-drivenwp-seo.vuethat maps the camelCasedseoobject touseSeoMeta/useHead(with site-settings fallbacks), pages addingseoto theirfieldsparam, and a titleTemplate guard since Yoast titles already include the site name. Use that as the template when rolling this out to other fuxt sites.