Structured data for article - #6052
Draft
VPS-julia wants to merge 6 commits into
Draft
Conversation
`getSiteConfigForDomain`/`getSiteConfigs` are plain env lookups, but they
lived in `siteConfig.ts`, whose top-level `import { headers } from "next/headers"`
taints every importer. That prevents them from being used in code that ends up
in the browser bundle (e.g. block loaders reachable from the block-preview route).
Move the two pure accessors into a dedicated `getSiteConfigs.ts` with no
request-scoped imports, and re-export them from `siteConfig.ts` so existing call
sites keep working unchanged. The header-dependent helpers stay in `siteConfig.ts`.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…tion The logic that resolves a DamImageBlock to an absolute image URL was private to `buildOrganization`. The Article structured data (added next) needs the same resolution for its `image` field, so extract it into `damImageToAbsoluteUrl`. Also split `buildOrganization` into `buildOrganizationNode` (the bare `Organization` object, for nesting as author/publisher) and the context-wrapped variant used at the page root, and have both take the content scope -- resolving the site URL from it -- instead of receiving a pre-resolved URL. The layout passes the scope accordingly. No change to the emitted output. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add the builders that produce the JSON-LD for the News surfaces: - `buildArticle` maps a news item to a schema.org `Article` (headline, image, datePublished/dateModified, author/publisher, mainEntityOfPage). Author and publisher default to a minimal `Organization` carrying the site name when no SiteSettings organization is configured. - `buildNewsItemList` maps a list of news items to an `ItemList` of `ListItem`s with absolute detail URLs. Both take the content scope and resolve the site config (absolute base URL and name) from it. Wiring into the surfaces follows in separate commits. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Emit schema.org `Article` structured data on the news detail route so search and generative engines can identify each news article. Extend the detail fragment with the fields the Article needs (`date`, `updatedAt`, `slug`) and load the site-wide SiteSettings organization in the page to fill author/publisher, falling back to the site name when no organization is configured. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Emit a schema.org `ItemList` for the curated news list rendered by NewsListBlock. The list is built in the loader rather than the component because the block renders inside a client component, which has no access to the site config needed for the absolute item URLs. The loader now returns both the news items and the prepared structured data. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Emit a schema.org `ItemList` for the `/news` index. Only the initially rendered page of items is encoded; items appended client-side via "Load more" are intentionally not part of the list, which is noted with a comment. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
VPS-julia
force-pushed
the
structured-data-for-article
branch
from
July 27, 2026 12:10
ae4b4e5 to
8f428aa
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
ArticleandItemListstructured data (JSON-LD) to the News surfaces in the Demo, so search engines and generative engines (GEO) can identify news articles and news listings. Without it there was no structured data for News. Demo only — the Starter has no News feature.Builds on the
JsonLdcomponent and the site-wideOrganization/SiteSettings work.Surfaces
/news/[slug])ArticleNewsListBlock(curated list on a CMS page)ItemList/news)ItemListNote
The ticket named
NewsDetailBlockfor the Article, but that block isn't the canonical article page — the/news/[slug]route is. TheArticleis emitted there somainEntityOfPagepoints at the real detail URL.Details
Article:headline,image(absolute DAM URL),datePublished(news.date),dateModified(news.updatedAt),author=publisher=Organizationfrom SiteSettings (falls back to a minimalOrganizationwith the site name when none is configured),mainEntityOfPage. No News entity schema change — there is no per-article author.ItemList:ListItems withposition,nameand absolute detail URLs, built viacreateSitePath+siteConfig.url./news, only the initially rendered page is encoded; items appended client-side via "Load more" are intentionally not part of the list (documented with a comment).getSiteConfigForDomain/getSiteConfigswere split out ofsiteConfig.tsintogetSiteConfigs.tsso theNewsListBlockloader can build absolute URLs server-side without pullingnext/headersinto the browser bundle. Existing call sites keep working via a re-export.Example
The news detail page emits:
{ "@context": "https://schema.org", "@type": "Article", "headline": "est depromo in hic", "image": "https://example.com/dam/images/…", "datePublished": "2026-07-23T22:49:04.167Z", "dateModified": "2026-07-27T09:29:04.191Z", "author": { "@type": "Organization", "name": "Comet Site Main" }, "publisher": { "@type": "Organization", "name": "Comet Site Main" }, "mainEntityOfPage": "https://example.com/en/news/est-depromo-in-hic" }Testing
All three surfaces were validated with validator.schema.org — 0 errors, 0 warnings for both
ArticleandItemList(index page andNewsListBlock).Changeset
None needed — Demo only.
Task: https://vivid-planet.atlassian.net/browse/COM-2968