Skip to content

Add JSON-LD structured data to docs pages#726

Open
IEvangelist wants to merge 6 commits intomainfrom
dapine/issue-681-jsonld-structured-data
Open

Add JSON-LD structured data to docs pages#726
IEvangelist wants to merge 6 commits intomainfrom
dapine/issue-681-jsonld-structured-data

Conversation

@IEvangelist
Copy link
Copy Markdown
Member

@IEvangelist IEvangelist commented Apr 16, 2026

Summary

  • add a shared JSON-LD helper for Starlight routes
  • emit build-time structured data from the shared head override
  • model the homepage as Organization/WebSite, standard docs as TechArticle, the FAQ page as FAQPage, release-style whats-new pages as TechArticle plus SoftwareApplication, and Aspire Conf as Event

Closes #681

Notes

  • FAQPage entries are derived from the visible H2 questions and answer content in the FAQ page.
  • Aspire Conf uses Event schema for the March 23, 2026 online event landing page and replay.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@IEvangelist IEvangelist force-pushed the dapine/issue-681-jsonld-structured-data branch from 9eca9f2 to 8ba551d Compare April 16, 2026 16:55
IEvangelist and others added 4 commits April 16, 2026 11:56
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@IEvangelist IEvangelist marked this pull request as ready for review April 16, 2026 20:56
Copilot AI review requested due to automatic review settings April 16, 2026 20:56
@IEvangelist IEvangelist enabled auto-merge (squash) April 16, 2026 20:58
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 build-time Schema.org JSON-LD generation for Aspire’s Starlight-driven site to improve structured metadata discoverability.

Changes:

  • Introduces a shared getStructuredData() utility that builds JSON-LD for different page types (home, docs articles, FAQ, release notes, Aspire Conf).
  • Injects the generated JSON-LD via the shared Starlight Head component.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/frontend/src/utils/structured-data.ts New JSON-LD builder/serializer plus FAQ extraction and release-version parsing logic.
src/frontend/src/components/starlight/Head.astro Emits the JSON-LD <script type="application/ld+json"> when route data is available.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/frontend/src/utils/structured-data.ts
@BethMassi
Copy link
Copy Markdown
Member

I'm testing this locally and I'm not seeing the sameAs links show up on the rendered homepage. We only should need it on the home page and the community page not needed on every article. It basically describes "us" - the org and our social channels belonging together.

Addresses PR feedback:

- Beth: sameAs should only appear on home + community pages. Added an explicit community schema (Organization + WebPage) so it shows there too, and strengthened home detection.

- Copilot: added Vitest coverage for getStructuredData() (home, community, generic TechArticle, release-version mapping, FAQ extraction, and JSON escaping of <, >, &, U+2028/U+2029).
@BethMassi
Copy link
Copy Markdown
Member

LGTM

Copy link
Copy Markdown
Member

@JamesNK JamesNK left a comment

Choose a reason for hiding this comment

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

Nice work — well-structured utility with good XSS escaping and test coverage. Three suggestions inline (two nits + one CI gap).

Comment on lines +428 to +429
.replace(/^[-*]\s+/, '');

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.

If a FAQ answer contains H3+ sub-headings (e.g. ### Details), the ### marker will survive into the plain-text answer since only H2 is used to split questions. Consider stripping heading markers from answer lines:\n\nsuggestion\n const cleanedLine = cleanInlineMarkdown(trimmed)\n .replace(/^#{3,6}\\s+/, '')\n .replace(/^\\d+\\.\\s+/, '')\n .replace(/^[-*]\\s+/, '');\n

Comment on lines +290 to +291
publisher: buildPublisher(siteUrl),
url: pageUrl,
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.

Nit: buildPublisher(siteUrl) is called twice here, creating two identical objects. Could assign to a local variable and reuse it for both author and publisher.\n\nsuggestion\n const publisher = buildPublisher(siteUrl);\n\n return {\n '@type': 'TechArticle',\n headline: route.entry.data.title,\n description,\n author: publisher,\n publisher,\n url: pageUrl,\n inLanguage: language,\n about: buildSoftwareApplication(siteUrl),\n };\n

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.

The new structured-data.vitest.test.ts file isn't wired into test:unit in package.json, so it won't run in CI or via pnpm test. Suggest adding:\n\njson\n\"test:unit\": \"pnpm test:unit:contracts && pnpm test:unit:components && pnpm test:unit:docs && pnpm test:unit:api-markdown && pnpm test:unit:structured-data\",\n\"test:unit:structured-data\": \"vitest run --config vitest.config.ts tests/unit/structured-data.vitest.test.ts\",\n

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.

Add Schema.org JSON‑LD structured data to Aspire docs for AI search discoverability

4 participants