Skip to content

Add TechArticle JSON-LD structured data to doc pages#673

Merged
danbarr merged 3 commits intomainfrom
add-jsonld-structured-data
Apr 7, 2026
Merged

Add TechArticle JSON-LD structured data to doc pages#673
danbarr merged 3 commits intomainfrom
add-jsonld-structured-data

Conversation

@danbarr
Copy link
Copy Markdown
Collaborator

@danbarr danbarr commented Apr 7, 2026

Description

Adds schema.org TechArticle JSON-LD structured data to every documentation page to improve organic search discovery. The implementation swizzles the DocItem/Layout component to automatically inject structured data from each page's existing frontmatter and Docusaurus metadata.

Changes:

  • Swizzle DocItem/Layout as a TypeScript wrapper that injects TechArticle JSON-LD into <head> on every doc page
  • Enable showLastUpdateTime in the docs config to populate dateModified in the schema (the rendered "Last updated" text is hidden via CSS)
  • Add optional schema_type: tutorial frontmatter field; applied to quickstart and tutorial pages to signal learningResourceType

The JSON-LD is baked into the static HTML at build time, so crawlers see it without JavaScript execution.

Type of change

  • Other: backend / internal

Submitter checklist

Content and formatting

  • I have reviewed the content for technical accuracy
  • I have reviewed the content for spelling, grammar, and style

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings April 7, 2026 19:53
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs-website Ready Ready Preview, Comment Apr 7, 2026 8:42pm

Request Review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds schema.org TechArticle JSON-LD structured data to Docusaurus doc pages by wrapping the DocItem/Layout theme component, and ensures lastUpdatedAt metadata is available for dateModified (while hiding the rendered “Last updated” UI).

Changes:

  • Swizzles DocItem/Layout to inject a per-page TechArticle JSON-LD <script> into <head>.
  • Enables showLastUpdateTime and hides the rendered “Last updated” element via global CSS.
  • Introduces optional schema_type: tutorial frontmatter on selected docs pages to emit learningResourceType.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/theme/DocItem/Layout/index.tsx Adds a wrapper that builds and injects TechArticle JSON-LD using useDoc() metadata/frontmatter.
src/css/custom.css Hides the rendered “Last updated” UI element while keeping metadata available.
docusaurus.config.ts Enables showLastUpdateTime to populate metadata.lastUpdatedAt for JSON-LD.
docs/toolhive/tutorials/mcp-optimizer.mdx Marks the page as tutorial via schema_type.
docs/toolhive/tutorials/custom-registry.mdx Marks the page as tutorial via schema_type.
docs/toolhive/guides-ui/quickstart.mdx Marks the page as tutorial via schema_type.
docs/toolhive/guides-k8s/quickstart.mdx Marks the page as tutorial via schema_type.
docs/toolhive/guides-cli/quickstart.mdx Marks the page as tutorial via schema_type.

danbarr and others added 3 commits April 7, 2026 16:40
Swizzle DocItem/Layout to inject TechArticle schema.org JSON-LD into
every documentation page, populated from frontmatter and Docusaurus
metadata. Enable showLastUpdateTime for dateModified (hidden via CSS).
Add schema_type frontmatter to tutorial and quickstart pages.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Address review feedback: use useDocusaurusContext to derive the page
URL from siteConfig.url instead of hardcoding, and add an id attribute
to the script tag for consistency with other JSON-LD blocks.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Dan Barr <6922515+danbarr@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@ChrisJBurns ChrisJBurns left a comment

Choose a reason for hiding this comment

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

LGTM! Reviewed with PR Briefing.

@danbarr danbarr merged commit 9a7db0c into main Apr 7, 2026
4 checks passed
@danbarr danbarr deleted the add-jsonld-structured-data branch April 7, 2026 21:12
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.

3 participants