Skip to content

Put full citation records into Yoast SEO's graph - #254

Merged
dknauss merged 7 commits into
mainfrom
claude/project-thread-6zozsp-yoast-records
Nov 6, 2026
Merged

dknauss merged 7 commits into
mainfrom
claude/project-thread-6zozsp-yoast-records

Conversation

@dknauss

@dknauss dknauss commented Nov 4, 2026

Copy link
Copy Markdown
Owner

Requested by Dan · project thread

Stacked on #252 (base is its branch); retarget to main once #252 merges.

Summary

Dan chose "Embed records in citation" after the trace in #253. Yoast's schema aggregator and NLWeb (its crawler and its WordPress plugin's MCP answers) read only Yoast's graph, where Borges put {@type, @id, name} stubs, so only 12 of 78 traced field values reached them.

  • bibliography_builder_get_cited_works() returns each cited work's full enriched record, the same one the ItemList carries, deduplicated by @id, without @context, and cached per request. bibliography_builder_get_cited_work_refs() now maps those to stubs.
  • The Yoast Article and WebPage filters (bibliography_builder_yoast_cited_works(), renamed from …_yoast_cited_work_refs() in Read the post from Yoast's context when adding citations #252) embed the full records.
  • New filter bibliography_builder_yoast_citation_records (default true); returning false restores the short references.
  • Rank Math and the no-SEO WebPage node keep the short references. Rank Math can follow if Dan wants it; I have no evidence about what reads its graph.
  • Cost: Yoast's script on the nine-work test page grows from 7.6 KB to about 29 KB.

Validation

  • composer test:php: OK (715 tests). New test_yoast_citations_carry_full_records checks records match the ItemList items by @id, carry no @context, and fall back to stubs when the filter returns false.
  • phpcs clean; Psalm "No errors found"; verify-metrics.sh green (PHP line count updated).
  • Live, with tools/yoast-nlweb-trace from Trace citation metadata through Yoast SEO and NLWeb #253 on WordPress 7.1.4 + Yoast 28.8 + NLWeb b423f15:
Stage Before After
Yoast graph 12/78 78/78
Yoast aggregator feed 12/78 78/78
NLWeb index (page and feed) 12/78 78/78
NLWeb WP plugin, MCP answer 12/78 (with #252) 78/78
NLWeb ranking prompt (4,000-char cut) 12/78 24/78

Checklist

  • Tests added
  • CHANGELOG (Unreleased, Changed) and CLAUDE.md updated
  • save() unchanged, so no deprecation

Generated by Claude Code

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
Yoast's schema aggregator and NLWeb (crawler and WordPress plugin MCP
answers) read only Yoast's graph, where Borges put {@type, @id, name}
stubs, so 12 of 78 traced field values reached them. The Yoast Article
and WebPage filters now embed each cited work's full record, the same
one the ItemList carries, deduplicated by @id and without @context.

The bibliography_builder_yoast_citation_records filter returns to the
short references. Rank Math and the no-SEO WebPage node keep them.

Verified with tools/yoast-nlweb-trace (PR #253): 78/78 at the Yoast
graph, aggregator feed, NLWeb index, and NLWeb MCP answer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WPtgA2F1J2N3yCPk3cUX1P
@dknauss dknauss self-assigned this Nov 4, 2026
@codecov

codecov Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.68%. Comparing base (30a3948) to head (48df6de).

Additional details and impacted files
@@            Coverage Diff            @@
##               main     #254   +/-   ##
=========================================
  Coverage     88.68%   88.68%           
  Complexity       67       67           
=========================================
  Files           102      102           
  Lines         10982    10989    +7     
  Branches        962      962           
=========================================
+ Hits           9739     9746    +7     
  Misses          445      445           
  Partials        798      798           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

dknauss commented Nov 4, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Focus areas: the full records embedded in Yoast's citation (bibliography_builder_get_cited_works() and bibliography_builder_yoast_cited_works() in includes/json-ld-enrichment.php), the per-request static cache, and the bibliography_builder_yoast_citation_records filter fallback.


Generated by Claude Code

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-06T17:50:53.908636Z 48df6de Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: bff16f19ba

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

…st-context' into claude/project-thread-6zozsp-yoast-records

# Conflicts:
#	docs/current-metrics.md
@dknauss
dknauss marked this pull request as ready for review November 6, 2026 17:48
Base automatically changed from claude/project-thread-6zozsp-yoast-context to main November 6, 2026 17:48
…-builder into yoast-records

# Conflicts:
#	CLAUDE.md
#	docs/current-metrics.md
#	includes/json-ld-enrichment.php
#	tests/fixtures/function-inventory.txt
#	tests/phpunit/JsonLdEnrichmentTest.php

dknauss commented Nov 6, 2026

Copy link
Copy Markdown
Owner Author

@codex review


Generated by Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 48df6de747

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@dknauss
dknauss merged commit 44217c1 into main Nov 6, 2026
22 checks passed
@dknauss
dknauss deleted the claude/project-thread-6zozsp-yoast-records branch November 6, 2026 18:08
@dknauss dknauss mentioned this pull request Nov 6, 2026
dknauss added a commit that referenced this pull request Nov 7, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants