Skip to content

Add TechArticle JSON-LD to tech docs pages - #445

Merged
jacobgkau merged 2 commits into
masterfrom
feat/techarticle-json-ld
Nov 9, 2026
Merged

jacobgkau merged 2 commits into
masterfrom
feat/techarticle-json-ld

Conversation

@erinxocon

Copy link
Copy Markdown
Member

Description:
Site Audit flags tech-docs pages under "Article page missing Article schema". This adds schema.org
TechArticle structured data to the docs pages through a Starlight route middleware.

What changed

  • New src/plugins/techarticle-json-ld-middleware.ts, registered in astro.config.ts (routeMiddleware
    is now an array: the existing ToC middleware plus this one).
  • It pushes a <script type="application/ld+json"> into starlightRoute.head. No component overrides.
  • Fields: headline (page title), description (only if the frontmatter has one), url and
    mainEntityOfPage (reuses Starlight's canonical link, so the /tech-docs base and host are right per
    environment), dateModified (git last-updated, omitted if unavailable), inLanguage, author,
    publisher.
  • Skipped on 404, the landing page and /archive/, which aren't articles.
  • < is escaped as \u003c so page text can't close the script tag.

@jacobgkau
jacobgkau requested a review from a team November 9, 2026 19:57
@jacobgkau jacobgkau self-assigned this Nov 9, 2026

@jacobgkau jacobgkau left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems very silly that a tool could already tell this was an article, we already provided all of the data it's asking for, but we need to copy the data from one set of tags into another to increase an audit score. But I don't see any problems with what's being added.

I still think canonical URLs without the trailing slash would've been better for articles, but again, we already list <link rel="canonical" href="... with the trailing slash, and what's being added here matches that.

@jacobgkau
jacobgkau merged commit 1f6af8f into master Nov 9, 2026
1 check passed
@jacobgkau
jacobgkau deleted the feat/techarticle-json-ld branch November 9, 2026 20:07
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