Repository navigation
Read the post from Yoast's context when adding citations - #252
Conversation
Borges added the cited works to Yoast SEO's Article (or WebPage) piece using the main query's post, so a graph Yoast built for another caller had no citations. NLWeb's WordPress plugin is one: it calls YoastSEO()->meta->for_post() to answer agents over MCP, and its answers lost the citation edge. Found while tracing citation metadata through Yoast and NLWeb on a local site. The Yoast filters now take the post from the context Yoast passes, and bibliography_builder_json_ld_page_url() accepts that post, passing it to its filter as a second argument. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WPtgA2F1J2N3yCPk3cUX1P
get_permalink() takes a WP_Post or an ID, so pass the context post's ID when it is some other object, and declare the context post as an object. docs/current-metrics.md follows the new first-party PHP line count. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WPtgA2F1J2N3yCPk3cUX1P
It already reads any object with post_content; Psalm now accepts the post from Yoast's context there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WPtgA2F1J2N3yCPk3cUX1P
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #252 +/- ##
============================================
+ Coverage 88.64% 88.68% +0.03%
Complexity 67 67
============================================
Files 102 102
Lines 10968 10982 +14
Branches 962 962
============================================
+ Hits 9723 9739 +16
+ Misses 447 445 -2
Partials 798 798 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
# Conflicts: # docs/current-metrics.md
|
@codex review Generated by Claude Code |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
measure.py read only 1-page.html, which the committed runs replace with 1-page-json-ld.json, so the published tables could not be recomputed without the stack. It now falls back to the extracted JSON-LD and picks Yoast's graph as the block with an @graph. Recomputing all four committed runs reproduces their survival.json byte for byte. The README now says the pr-252 rows need #252's context fix (78947a5 or later) checked out, and keeps the main baseline run separate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WPtgA2F1J2N3yCPk3cUX1P
* Trace citation metadata through Yoast SEO and NLWeb Adds tools/yoast-nlweb-trace: a local WordPress 7.1 + Borges + Yoast SEO 28.8 + NLWeb site, built by setup.sh, and scripts that capture the fixture post (the markup-value corpus) at each stage on the way to an agent: the page's JSON-LD, Yoast's graph, Yoast's schema aggregator feed, NLWeb's index (its own ingest code, from a crawl and from the feed), and NLWeb's WordPress plugin answering an MCP `ask`. measure.py scores 78 field values per stage; probe.py checks which questions each stage can still answer. Today only titles (and DOIs inside @id URLs) get past Yoast: the full records stay in Borges' ItemList, which NLWeb's trim drops. NLWeb's WordPress plugin got no citations at all (fixed in #252). Two prototypes show what putting full records into Yoast's graph would carry, and at what page weight. No model was run: the ranking LLM is a recording stub. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WPtgA2F1J2N3yCPk3cUX1P * Keep tools/ out of the persistence audit, and update the PHP line count The trace site's setup scripts set WordPress and plugin options on the throwaway site they build. tools/ is not in the release package, so the no-persistence audit now skips it, as the metrics doc says. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WPtgA2F1J2N3yCPk3cUX1P * Trace tool: recompute from committed captures; pin #252 for prototypes measure.py read only 1-page.html, which the committed runs replace with 1-page-json-ld.json, so the published tables could not be recomputed without the stack. It now falls back to the extracted JSON-LD and picks Yoast's graph as the block with an @graph. Recomputing all four committed runs reproduces their survival.json byte for byte. The README now says the pr-252 rows need #252's context fix (78947a5 or later) checked out, and keeps the main baseline run separate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WPtgA2F1J2N3yCPk3cUX1P --------- Co-authored-by: Claude <noreply@anthropic.com>
In-text and margin citations with Update citations after a style change (#256); annotated bibliographies (#258); h-cite microformats (#257); full citation records in Yoast SEO's graph and Yoast context fix (#252, #254); RIS journal abbreviations; sentence case in Harvard; the Playground demo example of citations and annotations (#259). Claude-Session: https://claude.ai/code/session_01WPtgA1cnwP9mYKwaWniaFS Co-authored-by: Claude <noreply@anthropic.com>
Requested by Dan · project thread
Summary
wpseo_schema_articleandwpseo_schema_webpagefilters now take the post from the Meta Tags Context that Yoast passes with each piece, and fall back to the queried post only when the context has no post.bibliography_builder_json_ld_page_url()takes an optional post, and passes it to thebibliography_builder_json_ld_page_urlfilter as a second argument.is_singular()/get_queried_object()), so a graph Yoast built for some other caller came back without thecitationedge. NLWeb's WordPress plugin is one such caller. It callsYoastSEO()->meta->for_post()to answer agents over MCP. On a local WordPress 7.1 + Yoast SEO 28.8 + NLWeb site, itsaskanswer for the fixture post had 0 citations before this change and 12 after. The page's own JSON-LD and Yoast's schema aggregator (/wp-json/yoast/v1/schema-aggregator/…) already had all 12, because both set up the global query state.I found this while tracing citation metadata through Yoast and NLWeb (the study PR follows separately). I didn't touch the Rank Math path. Its
rank_math/json_ldfilter has the same reliance on the main query, but I haven't tested it with a Rank Math caller outside the page request.Validation
composer test:phppasses: 714 tests. The newtest_yoast_pieces_read_the_post_from_yoast_contextfails onmainand passes here.phpcsis clean on the changed filestools/call askagainst a local site now returns the Article with itscitationlistChecklist
Generated by Claude Code