seo-geo
npx skills add https://github.com/crystallizeapi/ai --skill seo-geoSEO and GEO for Crystallize Storefronts
Search engines and AI answer engines read a store in three ways: the HTML <head> and its JSON-LD, plain-text
versions of the pages, and the crawl policy. A Crystallize catalogue with typed specs (numbers with units,
booleans, selections), topics and relations has every fact these readers need. This skill turns them into
structured data and text from the same rows, so the page, the JSON-LD and the Markdown never disagree.
The storefront side (Discovery reads, caching, routing) is in [[storefront]]. Letting agents act on the store (MCP, WebMCP, an assistant) is in [[agentic-commerce]]; this skill is the passive half.
Built and checked on three Crystallize storefronts (Tools Universe and two others), September–November 2026, and audited against Chrome’s Modern Web Guidance v1.0 on 2026-11-12. The JSON-LD of the live Tools Universe pages passes the vocabulary check in references/validation.md.
The principle: state only what the data holds
Every fact comes from Crystallize, and nothing is claimed that the data doesn’t hold.
- No
AggregateRatingwithout real reviews. Demo or seeded ratings stay out. - No
availabilitywithout stock.InStock/OutOfStockandinventoryLevelcome from the variant’s stock. - No
falsefor an unknown boolean. Discovery returns an unset boolean component asfalse. Treatfalseas “not stated” and leave it out of JSON-LD, Markdown and agent answers, unless the model guarantees every boolean is set. - No shipping or return policy unless the store has one. Google asks for them; don’t invent them.
- No guessed identifiers. A GTIN or national trade number that isn’t registered is “not registered”, not a made-up value.
- No drafts. The storefront never renders drafts to crawlers or the public: only the preview route reads
publicationState: draft, and it isnoindexand unlinked. On an open Discovery every draft is readable by anyone, so embargoed content does not belong in drafts there ([[storefront]]).
/** Discovery returns an unset boolean as false; the catalogue states the features a product has. */export const stated = (r: SpecRow) => r.value !== false;Checklist per page type
| Page | <head> |
JSON-LD | Text twin |
|---|---|---|---|
| Home | Title, description, canonical, hreflang, og:* |
Organization (or OnlineStore), WebSite with SearchAction |
/en.md, linked from /llms.txt |
| Category, brand, platform | Same; canonical without filter parameters | CollectionPage with an ItemList of the products on it; BreadcrumbList; the Brand or concept |
.md with the product table |
| Product | Same; og:image is the packshot in the original format |
Product, or ProductGroup with a Product per variant; Offer per variant; BreadcrumbList |
.md with the spec table and codes |
| Rental or service | Same | Product with Offers that are LeaseOut with leaseLength, availableAtOrFrom places |
.md |
| Article, landing page | Same | WebPage (or Article) in the site graph; FAQPage only from a real FAQ block |
.md |
| Search results | Static title, noindex, follow, canonical to the bare search page |
none | none |
| Cart, account, checkout | noindex |
none | none; disallowed in robots.txt |
| Draft preview | noindex; not linked, not in the sitemap |
none | none |
Every page:
-
<title>, description, canonical and hreflang are in the<head>of the HTML that crawlers get, not streamed into<body>(references/crawlers.md). -
<html lang>, hreflang andinLanguageare BCP 47 (nb, not the tenant’sno), withx-default. - Canonical and hreflang come from the translated generated paths, looked up by
itemId. No typed “canonical URL” component: it goes stale on the first rename. - The description is plain text, at most about 155 characters, cut at a word. Rich text never goes into
<meta>; ask Discovery forformat: plainText. -
<link rel="alternate" type="text/markdown">points at the page’s Markdown twin.
Where each fact comes from
| Fact | Crystallize source | schema.org |
|---|---|---|
| Name, description | Item name; an SEO piece or a plain-text summary | name, description |
| SKU, GTIN | Variant sku; a non-translatable gtin single line per variant |
sku, gtin13 / gtin12 / gtin14 by length |
| National trade numbers | An identifiers chunk (NOBB, NRF, …) | identifier as PropertyValue with propertyID |
| Numeric spec with unit | Numeric component (value + unit) | PropertyValue / QuantitativeValue with value, unitText, unitCode (UN/CEFACT Rec 20) |
| Bound (“max. diameter”) | The field id (maxDrillingDiameter) |
maxValue / minValue |
| Selection option | Selection component (option key + label) | valueReference as DefinedTerm with termCode |
| Classification code | Topic meta, or a topic map mirroring the code set (ETIM, GS1 GPC, UNSPSC) |
category as CategoryCode with codeValue and inCodeSet |
| Product type | The type topic’s path | category as text (“Drilling > Combi drill”), what Google Merchant reads |
| Keywords | Trade, material, feature topics | keywords |
| Price | Discovery <variant>Price per market; volume tiers |
Offer.price incl. VAT, UnitPriceSpecification incl. and excl. VAT, eligibleQuantity |
| Stock | <location>Stock per variant |
availability, inventoryLevel |
| Accessory, consumable | Item relations | isAccessoryOrSparePartFor, isConsumableFor, isRelatedTo |
| What’s in the box | A paragraph or chunk with item relations | Offer.includesObject as TypeAndQuantityNode |
| Warranty | Numeric component in years | Offer.warranty as WarrantyPromise |
| Breadcrumbs | Discovery breadcrumbs (ends with the item itself) |
BreadcrumbList |
| Paths per language | Discovery, one aliased query by itemId |
hreflang; @ids per language |
lastModified |
updatedAt on every Discovery hit |
sitemap <lastmod> |
Code for all of it: references/json-ld.md. Modelling the specs so these facts exist is in [[content-model]] and [[taxonomy]].
Share images and JSON-LD images
og:image and schema.org image are read by link-preview bots and crawlers that don’t all decode AVIF. Use an
absolute URL to the original format (JPEG or PNG), else WebP, never AVIF, at least 1200 px wide when the
source allows. The variant ladder is capped at the source width, so a 1200 px source tops out at 1024: use the
image’s url then, which is the original upload, with the image’s own width and height (unless the upload is
itself AVIF). Give og:image its width and height, and use the white-background packshot for Product
JSON-LD.
/** og:image, twitter:image and JSON-LD images: original format first, then WebP, never AVIF, 1200 px or wider. */const isAvif = (url: string) => /\.avif(\?|$)/i.test(url);const formatRank = (url: string) => (isAvif(url) ? 2 : /\.webp(\?|$)/i.test(url) ? 1 : 0);
type ShareImage = { url: string; width?: number; height?: number };
export function shareImage(image?: { url: string; width?: number | null; height?: number | null; variants?: { url: string; width: number; height: number }[] | null;} | null): ShareImage | undefined { if (!image) return undefined; const best = (image.variants ?? []) .filter((v) => !isAvif(v.url)) .sort((a, b) => formatRank(a.url) - formatRank(b.url) || b.width - a.width)[0]; if (best && best.width >= 1200) return best; // The ladder stops below the source width, so the original upload is the larger file. if (!isAvif(image.url)) return { url: image.url, width: image.width ?? undefined, height: image.height ?? undefined }; return best; // an AVIF upload: the widest WebP rendition is all there is}The same helper is in [[responsive-images]]; keep the two in step.
On-page images are a different question: see [[responsive-images]] (WebP over AVIF, sizes).
Text for answer engines
/llms.txt(llmstxt.org): what the store is, markets, currencies and VAT, how versions, platforms and specs work, the MCP endpoint, then links to the Markdown page of every category, brand and concept page./llms-full.txt: the whole catalogue in one file, with prices incl. and excl. VAT, stock, classification and every typed spec with its codes.- A Markdown twin of every page:
<url>.md, and the same URL withAccept: text/markdown(Vary: Accept). The twin isnoindexwith a canonicalLinkheader to the HTML page.
Code: references/llms-and-markdown.md.
Crawl policy
- robots.txt allows everything that is the same for every visitor, disallows per-shopper routes (cart,
account, API, OAuth, MCP hand-offs), names the AI crawlers in their own block, and adds
Content-Signal: search=yes, ai-input=yes(training left unstated, or set as you decide). - A noindex page must stay crawlable. Search results are
noindex, follow; disallowing them hides the noindex and the links. - Sitemap: every page in every language, hreflang alternates joined on
itemId,lastModifiedfromupdatedAt, and a sitemap index above a few thousand URLs. - Metadata in
<head>for every user agent, including Googlebot behind a CDN.
Code and the curl checks: references/crawlers.md.
Pitfalls
| Symptom | Cause | Fix |
|---|---|---|
Googlebot sees no <title>, canonical or hreflang |
Dynamic generateMetadata streamed into <body>; the CDN served the cached shell |
Prerender each sitemap path; metadata from cached reads only; test with real Googlebot UAs |
| JSON-LD says a tool has no hammer mode | Unset boolean read as false |
Treat false as “not stated” |
| Description shows HTML or is cut mid-word | Rich text in <meta> |
Plain text, ≤ 155 characters, cut at a word |
| Link previews show no image | AVIF og:image |
Original format or WebP |
| Canonical points at an old URL | A typed canonical component | Canonical from the current translated path |
| hreflang rejected or ignored | Tenant code (no) instead of BCP 47 (nb); hreflang outside <head> |
nb, x-default, in <head> |
| Crawlers only see one market’s prices | Market chosen by cookie | Market in the path |
| Search results indexed, or their links never followed | Disallowed in robots.txt instead of noindex, follow |
Allow crawling, noindex |
| Search page title lacks the query, or streams late | generateMetadata reads searchParams |
Static metadata on the search page |
| Filtered category views compete with the category | Canonical carries filter parameters | Canonical to the clean category |
| Merchant listing warnings | schema.org-valid but missing what Google asks for | Rich Results Test; add only what the store really has |
| Unit filters and codes wrong | Several units on one numeric; units without a Rec 20 code guessed | One unit per numeric; no code rather than a wrong one |
Live examples
- tools-universe.superfast.shop: Product/ProductGroup JSON-LD with ETIM
CategoryCode, UN/CEFACT units, rentals asLeaseOutoffers;/llms.txt,/llms-full.txt,.mdtwins; the robots.txt and sitemap described here. Its/en/mcppage explains the AI-ready setup. - photo-store-vector.superfast.shop/llms.txt: llms.txt for a B2C and B2B store with typed lens and camera specs.
- More stores, by capability: superfast.shop/demos.json; see [[storefront]].
References
| File | Read it when |
|---|---|
| references/json-ld.md | Emitting JSON-LD for products, variants, offers, specs, listings, brands |
| references/llms-and-markdown.md | Publishing llms.txt, llms-full.txt and Markdown twins |
| references/crawlers.md | robots.txt, AI crawlers, htmlLimitedBots, metadata in <head>, sitemaps |
| references/validation.md | Checking JSON-LD against schema.org and Google, and crawler-eye curl checks |
Related skills
[[storefront]] for the Discovery reads, caching and routing this builds on; [[content-model]] for typed specs, units and identifiers; [[taxonomy]] for classification codes in topic meta; [[information-architecture]] for paths and redirects; [[responsive-images]] for images; [[agentic-commerce]] for agents that act on the store.
Reference Details
Crawlers: robots.txt, AI crawlers, metadata in <head>, sitemaps
robots.txt
Crawl everything that is the same for every visitor. Keep out what is per-shopper (cart, account) or technical
(API, OAuth, MCP hand-off routes). Name the AI crawlers in their own block: several look for their own
User-Agent, and naming them makes letting them in a deliberate, easy-to-change choice. From a working store
(app/robots.ts):
import type { MetadataRoute } from "next";
const PRIVATE = ["/api/", "/oauth/", "/mcp/", "/*/cart", "/*/account"];
const AI_AGENTS = [ "GPTBot", "OAI-SearchBot", "ChatGPT-User", "ClaudeBot", "Claude-User", "Claude-SearchBot", "anthropic-ai", "PerplexityBot", "Perplexity-User", "Google-Extended", "Applebot-Extended", "Amazonbot", "meta-externalagent", "DuckAssistBot", "MistralAI-User", "CCBot",];
export default function robots(): MetadataRoute.Robots { return { rules: [ { userAgent: "*", allow: "/", disallow: PRIVATE, // Content Signals (contentsignals.org): searchable and usable as live input to AI answers. // Training is left unstated. other: { "Content-Signal": "search=yes, ai-input=yes" }, }, { userAgent: AI_AGENTS, allow: "/", disallow: PRIVATE }, ], sitemap: absolute("/sitemap.xml"), };}- Set
ai-train=yesornoinContent-Signalas the business decides; leaving it out states nothing. - Don’t disallow a page you mark
noindex. A crawler that may not fetch the page never sees thenoindex, and never follows its links. Search results arenoindex, followand crawlable. One store disallowed/search?, which hid the noindex. - A page that explains the store to agents (an MCP setup page, say) is content: keep it open.
- No
Host:line; it is non-standard. - Staging and preview deployments send
X-Robots-Tag: noindexsite-wide ([[storefront]] security headers). - The draft preview route is
noindex, never linked and never in the sitemap. Drafts are never rendered on public pages.
Metadata must be in the <head> crawlers get
Google ignores canonical and hreflang outside <head>, and crawlers that don’t run JavaScript only see the raw
HTML. Next.js 16 streams metadata into <body> for normal browsers.
What happened on a live store (found in a Modern Web Guidance audit, confirmed with curl):
- With Cache Components and PPR, a dynamic
generateMetadatawas streamed into<body>instead of the static shell’s<head>. - On Vercel, real Googlebot user agents were served the cached shell (
x-vercel-cache: HIT) with no<title>, description, canonical or hreflang on product and category pages:</head>at byte 1191, the metadata only inside the RSC flight data. bingbot, ClaudeBot and GPTBot gotBYPASSand a full<head>. Browsers got the title about 300 KB into the HTML. - Googlebot was in
htmlLimitedBots, but the cached shell won. - Root cause: the catch-all route had no
generateStaticParams, so every catalogue URL shared one App Shell, and that shell can’t hold path-dependent metadata.
The rule: keep metadata cacheable, and give every URL its own shell.
generateMetadatareads onlyparamsand cached Discovery reads: nocookies(),headers()orsearchParams. Then it lands in the shell’s<head>for every user agent.generateStaticParamsreturns every sitemap path, so each URL is prerendered with its own shell. Items published after the build get the App Shell first and are prerendered on their first visit.- The search page’s metadata is static (reading
searchParamsdeferred it to request time and streamed it).
Code: [[storefront]] references/performance.md.
htmlLimitedBots
htmlLimitedBots tells Next.js which user agents get blocking metadata in <head> instead of streamed. Most
builds list search engines, AI crawlers and link-preview bots:
htmlLimitedBots: /Googlebot|Google-InspectionTool|bingbot|Applebot|DuckDuckBot|YandexBot|Baiduspider|GPTBot|OAI-SearchBot|ChatGPT-User|ClaudeBot|Claude-User|Claude-SearchBot|anthropic-ai|PerplexityBot|Perplexity-User|CCBot|facebookexternalhit|Twitterbot|LinkedInBot|Slackbot|Discordbot|WhatsApp|TelegramBot/i,Observed both ways for Googlebot; verify on your deployment. One build removed Googlebot from the list: Next
treats it as a DOM bot, and on Vercel it was served the prerendered shell plus the streamed rest; with Googlebot
listed, the streamed part skipped the metadata and on-demand pages reached Googlebot with nothing. Another build
kept Googlebot listed and fixed the same symptom with generateStaticParams for every path. Per-URL shells with
cacheable metadata make the list matter less. In both cases bots in the list reaching pages unknown at build
caused “Expected the resume to render
generateStaticParams.
htmlLimitedBots does not help when a CDN serves a cached shell to that UA.
Check it with the real user agents
Use the full user-agent strings, not a shortened Googlebot, and test the deployment: a local next start
upgraded the App Shell after the first visit while production did not.
URL=https://shop.example/en/some/category/some-productfor UA in \ 'Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; Googlebot/2.1; +http://www.google.com/bot.html) Chrome/138.0.0.0 Safari/537.36' \ 'Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)' \ 'Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm) Chrome/138.0.0.0 Safari/537.36' \ 'Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)' \ 'Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; GPTBot/1.2; +https://openai.com/gptbot'; do html=$(curl -s -A "$UA" "$URL") head_end=$(printf '%s' "$html" | grep -bo '</head>' | head -1 | cut -d: -f1) title_at=$(printf '%s' "$html" | grep -bo '<title>' | head -1 | cut -d: -f1) echo "$(curl -sI -A "$UA" "$URL" | grep -i '^x-vercel-cache' | tr -d '\r') head_end=$head_end title_at=${title_at:-none} canonical=$(printf '%s' "$html" | grep -c 'rel="canonical"') hreflang=$(printf '%s' "$html" | grep -oi 'hreflang="' | wc -l | tr -d ' ')"doneA good result: title_at smaller than head_end, one canonical and an hreflang per language plus x-default,
for every UA. (React writes the attribute as hrefLang, hence grep -i.) A broken one, as measured on a live store
before the fix:
x-vercel-cache: HIT head_end=1191 title_at=none canonical=0 hreflang=0 # Googlebotx-vercel-cache: BYPASS head_end=4865 title_at=1681 canonical=1 hreflang=5 # ClaudeBotSitemaps
Every page in every language, each with hreflang alternates to the same item in the other languages (joined on
itemId, because paths are translated), and lastModified from Discovery’s updatedAt:
export default async function sitemap(): Promise<MetadataRoute.Sitemap> { const all = await Promise.all(LANGS.map(async (l) => [l, await allItems(l)] as const)); // one browse per language const byItem = new Map<string, Partial<Record<Lang, string>>>(); for (const [l, items] of all) for (const i of items) byItem.set(i.itemId, { ...byItem.get(i.itemId), [l]: absolute(`/${l}${i.path}`) }); const languages = (urls: Partial<Record<Lang, string>>) => ({ ...Object.fromEntries(LANGS.flatMap((l) => (urls[l] ? [[HREFLANG[l], urls[l]!]] : []))), "x-default": urls.en ?? Object.values(urls)[0]!, }); return all.flatMap(([lang, items]) => items.map((i) => ({ url: absolute(`/${lang}${i.path}`), lastModified: i.updatedAt, changeFrequency: "weekly" as const, alternates: { languages: languages(byItem.get(i.itemId) ?? {}) }, })), );}hreflangkeys are BCP 47 (nb), withx-default.- Above a few thousand URLs, split into a sitemap index by type (pages, categories, products). One store had 2,112
URLs with 10,560
xhtml:linkalternates in one file. - A full Discovery scan can come back incomplete during re-indexing. Read with retry, union the passes, and check
the count against a
searchtotal. - Leave out old paths (they are in the item’s path history and should 301) and per-shopper pages.
Canonicals
- Canonical from the item’s current path in this language, absolute.
- Filtered and sorted category views point at the clean category: facets as GET links can be crawled, but don’t compete with the category.
- A shortcut path (the same item reachable from a second folder) is a duplicate: canonical to the item’s main path.
- Paginated listings: each page canonical to itself, or render “load more” for people and keep page 1 canonical.
JSON-LD from typed Crystallize data
One @graph per page, with stable @ids, so a product, its brand page and its platform page describe the same
entities. Everything is built from the Discovery read the page already made. The code is trimmed from a working
storefront (lib/seo.ts); field names such as defaultPrice, defaultStock and nokPrice are generated from
the tenant’s price variants and stock locations, so yours will differ.
Render it escaped, so content can’t close the tag:
export function JsonLd({ data }: { data: unknown }) { return ( <script type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify(data).replace(/</g, "\\u003c") }} /> );}Site graph: Organization and WebSite
On the home page. Other pages reference them by @id.
const ORG = `${SITE_URL}/#organization`;const WEBSITE = `${SITE_URL}/#website`;
export const organization = (lang: Lang) => ({ "@type": ["Organization", "OnlineStore"], "@id": ORG, name: SITE_NAME, url: SITE_URL, logo: { "@type": "ImageObject", url: absolute("/icon.svg") }, areaServed: ["NO", "SE", "NL"].map((c) => ({ "@type": "Country", name: c })), knowsLanguage: LANGS.map((l) => HREFLANG[l]), // BCP 47: "nb", not "no"});
export const website = (lang: Lang) => ({ "@context": "https://schema.org", "@graph": [ organization(lang), { "@type": "WebSite", "@id": WEBSITE, url: absolute(`/${lang}`), name: SITE_NAME, inLanguage: MARKET[lang].locale, publisher: { "@id": ORG }, potentialAction: { "@type": "SearchAction", target: { "@type": "EntryPoint", urlTemplate: absolute(`/${lang}/search?q={search_term_string}`) }, "query-input": "required name=search_term_string", }, }, ],});
export const breadcrumbs = (items: { name: string; path: string }[]) => ({ "@type": "BreadcrumbList", itemListElement: items.map((it, i) => ({ "@type": "ListItem", position: i + 1, name: it.name, item: absolute(it.path), })),});Discovery’s breadcrumbs end with the item itself; that is what BreadcrumbList wants.
Prices: incl. and excl. VAT
Prices in Crystallize are usually net. State the price the shopper pays as price, and both incl. and excl. VAT
as UnitPriceSpecifications, with volume tiers as eligibleQuantity:
function price(net: number, lang: Lang, tiers: { threshold: number; price: number }[] = []) { const m = MARKET[lang]; const spec = (p: number, minQty?: number) => [true, false].map((incl) => ({ "@type": "UnitPriceSpecification", price: incl ? round(p * (1 + m.vat)) : round(p), priceCurrency: m.currency, valueAddedTaxIncluded: incl, ...(minQty && { eligibleQuantity: { "@type": "QuantitativeValue", minValue: minQty, unitCode: "C62" } }), })); return { price: round(net * (1 + m.vat)), priceCurrency: m.currency, priceSpecification: [...spec(net), ...tiers.flatMap((t) => spec(t.price, t.threshold))], };}A B2B store whose price is per case, excl. VAT, for business buyers only (from a food wholesale build):
offers: { "@type": "Offer", url: absolute(url), price: v.defaultPrice, priceCurrency: "EUR", itemCondition: "https://schema.org/NewCondition", seller: { "@id": `${SITE_URL}/#organization` }, eligibleCustomerType: "http://purl.org/goodrelations/v1#Business", priceSpecification: { "@type": "UnitPriceSpecification", price: v.defaultPrice, priceCurrency: "EUR", valueAddedTaxIncluded: false, referenceQuantity: { "@type": "QuantitativeValue", value: 1, unitText: "case" }, },},Never put a contract price in JSON-LD: it is per customer, and the page is public.
A product sold only on quote gets an Offer with a description (“price on request”) and no price.
Units: UN/CEFACT Rec 20
A numeric component with a unit becomes a QuantitativeValue (or a PropertyValue carrying the same fields):
value, unitText as written, and unitCode from UN/CEFACT Recommendation 20. The content model’s unit list
has no slot for the code, so the storefront maps it. Give no code rather than a guess.
const CODES: Record<string, string> = { mm: "MMT", cm: "CMT", m: "MTR", g: "GRM", kg: "KGM", l: "LTR", V: "VLT", A: "AMP", Ah: "AMH", W: "WTT", Wh: "WHR", Nm: "NU", J: "JOU", kN: "B47", kPa: "KPA", mbar: "MBR", "m/s": "MTS", "m/s²": "MSK", "m³/h": "MQH", lm: "LUM", "dB(A)": "2N", "°": "DD", "%": "P1", h: "HUR", min: "MIN", s: "SEC", years: "ANN",};
/** "1/min" is a rotational speed (RPM) on speed fields and a frequency (C94) on impact or stroke rates. */export function unitCode(unit: string | null | undefined, field = ""): string | undefined { if (!unit) return undefined; if (unit === "1/min") return /speed/i.test(field) ? "RPM" : "C94"; return CODES[unit];}
/** A bound ("max. drilling diameter") from the field id. */export function boundOf(field: string): "max" | "min" | undefined { const id = field.split(".").at(-1) ?? field; if (/^max[A-Z_]|Max($|[A-Z_])/.test(id)) return "max"; if (/^min[A-Z_]|Min($|[A-Z_])/.test(id)) return "min"; return undefined;}Use one unit per numeric where you can: Discovery range filters ignore the unit, so a field stored in both mm and
cm compares 10 with 100. Pieces (counts) are C62.
Typed specs as additionalProperty
Turn every typed component into one row first, then render the row as a page table, a Markdown table and a
PropertyValue. A row holds the label, value, unit, unit code, bound, the classification feature code (for
example ETIM EF…) and, for selections, the option keys with their codes:
export type SpecRow = { key: string; label: string; text: string; value: number | string | boolean; unit?: string | null; unitCode?: string; bound?: "max" | "min"; etim?: string; // feature code, e.g. EF000001 options?: { key: string; label: string; etim?: string }[]; items?: { name: string; path: string }[]; // relations (e.g. the platforms a battery fits)};
function property(r: SpecRow): Record<string, unknown> { const n = typeof r.value === "number" ? r.value : null; return { "@type": "PropertyValue", name: r.label, ...(r.etim && { propertyID: r.etim }), value: r.value, ...(n != null && r.bound === "max" && { maxValue: n }), ...(n != null && r.bound === "min" && { minValue: n }), ...(r.unit && { unitText: r.unit }), ...(r.unitCode && { unitCode: r.unitCode }), ...(r.options && { valueReference: r.options.map((o) => ({ "@type": "DefinedTerm", name: o.label, termCode: o.key, ...(o.etim && { identifier: { "@type": "PropertyValue", propertyID: "ETIM", value: o.etim } }), })), }), };}
const specs = specGroups(p.specs, p.power, p.physical, lang) .flatMap((g) => g.rows) .filter(stated);Discovery returns a numeric component as { <field>: number, <field>Unit: string } in the hit, a boolean as a
boolean, and a selection as a hash of option key → label. The row builder walks those (skip *Unit keys and
nulls). A selection option can’t carry an external code in the model, so keep codes in a generated labels
file or in the component’s description, and look them up by option key.
Classification codes from topics
Keep classification codes (ETIM class EC…, GS1 GPC, UNSPSC, Google product category) in topic meta, or in a
topic map that mirrors the code set (/etim/<group>/<class>). Emit them as CategoryCode, alongside the product
type as plain text:
const ETIM_SET = { "@type": "CategoryCodeSet", name: "ETIM International classification", url: "https://www.etim-international.com/" };
/** Discovery `topics` is a hash: topic path → "Map > Parent > Leaf". */export function classification(topics: Record<string, string> | null | undefined) { const entries = Object.entries(topics ?? {}); const type = entries .filter(([k]) => k.startsWith("/category/")) .sort((a, b) => b[0].split("/").length - a[0].split("/").length)[0]; const etim = entries.find(([k]) => k.startsWith("/etim/")); const code = etim?.[0].split("/").at(-1)?.toUpperCase(); return { type: type?.[1].split(" > ").slice(1).join(" > "), etim: etim && code ? { code, name: etim[1].split(" > ").at(-1)! } : undefined, };}
category: [ type, // "Drilling & driving > Combi drill": what Google Merchant reads etim && { "@type": "CategoryCode", codeValue: etim.code, name: etim.name, inCodeSet: ETIM_SET },].filter(Boolean),Keyword-like topics (trade, material, feature, level) become a comma-separated keywords.
Identifiers
sku is the merchant’s SKU; the GTIN is a separate fact (a kit and a bare tool have different GTINs). Pick the
property from the length:
const gtin = (g?: string | null) => { const d = g?.replace(/\D/g, ""); return d ? d.length === 13 ? { gtin13: d } : d.length === 12 ? { gtin12: d } : d.length === 14 ? { gtin14: d } : { gtin: d } : {};};
const ids = (x: Variant) => ({ sku: x.sku, ...gtin(x.gtin), ...(x.nobbNumber && { identifier: { "@type": "PropertyValue", propertyID: "NOBB", value: x.nobbNumber } }),});Product, or ProductGroup with a Product per variant
One variant: a Product with one Offer. Several: a ProductGroup (productGroupID = the item id) whose
hasVariant lists a Product per variant, each with its own identifiers, images and Offer:
const offer = (x: Variant) => ({ "@type": "Offer", name: x.name ?? undefined, sku: x.sku, ...gtin(x.gtin), url, ...price(netFor(x, lang), lang, tiersOf(x)), availability: `https://schema.org/${(x.defaultStock ?? 0) > 0 ? "InStock" : "OutOfStock"}`, inventoryLevel: { "@type": "QuantitativeValue", value: Math.max(0, x.defaultStock ?? 0), unitCode: "C62" }, itemCondition: "https://schema.org/NewCondition", ...(country && { eligibleRegion: { "@type": "Country", name: country } }), ...(box.length && { includesObject: box }), // TypeAndQuantityNode per item in the box ...(warranty && { warranty }), // WarrantyPromise with durationOfWarranty in ANN seller: { "@id": ORG },});
const node = p.variants.length > 1 ? { "@type": "ProductGroup", "@id": `${url}#product`, productGroupID: p.itemId, ...common, // name, url, description, image, brand, category, keywords, additionalProperty, relations hasVariant: p.variants.map((x) => ({ "@type": "Product", "@id": `${url}#${x.sku}`, name: `${p.name} (${x.name ?? x.sku})`, ...ids(x), isVariantOf: { "@id": `${url}#product` }, offers: offer(x), })), } : { "@type": "Product", "@id": `${url}#product`, ...ids(v), ...common, offers: offer(v) };
return { "@context": "https://schema.org", "@graph": [node, breadcrumbs(crumbs)] };common also carries:
brand: aBrandwith the brand page’s@id(…/brand-path#brand), so the brand page defines the same entity.weight,width,height,depthasQuantitativeValues from the physical specs.releaseDatefrom a launch date.image: up to six images, throughshareImage(img)?.url(original format, never AVIF).
Relations
Item relations become typed links to other products’ @ids:
const productRef = (lang: Lang, it: { name?: string | null; path?: string | null }) => it.path ? { "@type": "Product", "@id": `${absolute(`/${lang}${it.path}`)}#product`, name: it.name ?? undefined, url: absolute(`/${lang}${it.path}`) } : null;
...(fits.length && { [consumable ? "isConsumableFor" : "isAccessoryOrSparePartFor"]: fits }),...(pairs.length && { isRelatedTo: pairs }),A shared concept with its own page (a battery platform, a collection, a technology) is a DefinedTerm with that
page’s @id; products point at it from an additionalProperty valueReference, and the concept page puts the
same term at the top of its graph.
Rentals and services
A rented machine is a Product with one Offer per rental period, leased out from the depots that hold it:
{ "@type": "Offer", name: periodName(v), sku: v.sku, url, businessFunction: "http://purl.org/goodrelations/v1#LeaseOut", leaseLength: { "@type": "QuantitativeValue", value: hoursOf(v), unitCode: "HUR", unitText: "h" }, price: p.price, priceCurrency: p.priceCurrency, priceSpecification: p.priceSpecification.map((s) => ({ ...s, referenceQuantity: hours })), availability: `https://schema.org/${pool > 0 ? "InStock" : "OutOfStock"}`, availableAtOrFrom: depots.map((d) => ({ "@type": "Place", name: d.name, address: { "@type": "PostalAddress", streetAddress: d.street, postalCode: d.postalCode, addressLocality: d.city }, geo: { "@type": "GeoCoordinates", latitude: d.lat, longitude: d.long }, })), availableDeliveryMethod: "https://schema.org/OnSitePickup", seller: { "@id": ORG },}leaseLength is a property of Offer, not Product: the vocabulary check catches that.
Listings: CollectionPage with an ItemList
Category, brand and platform pages list the products on the page, each with its default variant’s price and stock:
{ "@type": "CollectionPage", "@id": url, name, url, inLanguage: MARKET[lang].locale, isPartOf: { "@id": WEBSITE }, ...(about && { about }), // the Brand or DefinedTerm the page is about mainEntity: { "@type": "ItemList", name, numberOfItems: total, itemListElement: items.map((p, i) => ({ "@type": "ListItem", position: i + 1, url: absolute(`/${lang}${p.path}`), item: listedProduct(p, lang) })), },}A brand page adds a Brand (logo, slogan, sameAs the brand’s own site) and points about at it.
Other page types
- Article, about, info pages:
WebPage(orArticle) withisPartOfthe website andpublisherthe organisation. - FAQPage only from a real FAQ block in the content, never generated.
- Recipe from a recipe shape, with the products it uses linked (a food build does this).
- Short factual Q&A built from typed specs (“Does it have a hammer mode? Yes.”) is fine on the page, shown only when the value exists.
What Google asks for beyond schema.org
Merchant listings ask for shippingDetails, hasMerchantReturnPolicy and review data. State them only if the
store has them. Check with the Rich Results Test (validation.md).
llms.txt, llms-full.txt and Markdown twins
Answer engines quote text. A Crystallize store can give them its own: a short map of the site (/llms.txt), the
whole catalogue in one file (/llms-full.txt), and a Markdown version of every page. All three are built from
the same cached Discovery reads and the same typed spec rows as the pages and the JSON-LD, so they never
disagree and they follow a publish in the same revalidation ([[storefront]]).
/llms.txt
Follows llmstxt.org: an # title, a > summary, a few lines on how the store works, then
sections of links. Link to the Markdown twins, not the HTML pages. What to say up front:
- What the store sells, to whom, and in which markets, currencies and VAT rates. Which part of the URL decides the market.
- Whether catalogue prices are net, and what each segment sees (incl. or excl. VAT).
- How the catalogue is structured: versions and variants with their own SKU and price, platforms or systems that decide compatibility, what typed specs and codes mean.
- The MCP endpoint, if there is one, and the page that explains it.
- That every page has a Markdown version (
.mdsuffix orAccept: text/markdown), and the languages. - Where the data comes from (for example, manufacturer data).
Trimmed from a working store:
export async function llmsTxt() { const items = await allItems("en"); // one cached browse per shape const of = (shape: string) => items.filter((i) => i.shape === shape); return [ `# ${SITE_NAME}`, "", `> ${SUMMARY}`, "", "- Markets and currencies: … The site language decides the market: `/en` EUR, `/no` NOK, `/sv` SEK.", "- Prices in the catalogue are net, excluding VAT. Trade customers see prices excl. VAT; consumers incl. VAT.", "- Specs are typed: numbers with their unit (and its UN/CEFACT code), yes/no, and fixed option sets, with ETIM codes.", `- MCP server for AI assistants: ${absolute("/api/mcp")} (Streamable HTTP). Setup and tools: ${absolute("/en/mcp")}.`, "- Every page has a Markdown version: append `.md` to its URL (`/en.md` for the front page), or request it with `Accept: text/markdown`.", "", "## Catalogue", "", `- [Front page](${mdUrl("en", "/")})`, ...of("category").map((c) => `- [${c.name}](${mdUrl("en", c.path)}): ${c.tagline ?? ""}`.trim()), "", "## Brands", "", ...of("brand").map((b) => `- [${b.name}](${mdUrl("en", b.path)})`), "", "## Optional", "", `- [Full catalogue with prices](${absolute("/llms-full.txt")}): every product in one file`, `- [Search](${absolute("/en/search?q=")}): append a term`, `- [Sitemap](${absolute("/sitemap.xml")})`, "", ].join("\n");}
// app/llms.txt/route.tsexport async function GET() { return new Response(await llmsTxt(), { headers: { "content-type": "text/markdown; charset=utf-8" } });}Write it in the default language and link the other languages’ front pages.
/llms-full.txt
The catalogue in one file: per category, every product with brand, price incl. and excl. VAT per currency, SKU, stock, the Markdown link, classification and every stated typed spec with its codes. Page through Discovery with the cursor, in a cached function:
let after: string | null = null;do { const data = await discovery( `query Typed($after: String) { browse { product(language: en, pagination: { limit: 100, after: $after }, sorting: { path: asc }) { summary { hasMoreHits endToken } hits { path topics ${SPEC_FIELDS} } } } }`, after ? { after } : {}, ); for (const t of data.browse.product.hits) { const facts = specGroups(t.specs, t.power, t.physical, "en") .flatMap((g) => g.rows) .filter(stated) // unset booleans read false: leave them out .map((r) => `${r.label} ${specFact(r)}${r.etim ? ` [${r.etim}]` : ""}`); out.set(t.path, facts.join(" · ")); } after = data.browse.product.summary.hasMoreHits ? data.browse.product.summary.endToken : null;} while (after);
/** "230 Nm (NU)", "SDS-max (EV005657)": the value with its codes, for text-only readers. */export function specFact(r: SpecRow) { const codes = [r.unitCode, ...(r.options ?? []).map((o) => o.etim)].filter(Boolean); return `${r.text}${codes.length ? ` (${codes.join(", ")})` : ""}`;}A full scan of a large index can come back incomplete when Discovery is re-indexing (totals flicker, hasMoreHits
false too early). For files that claim to be complete, compare the count with a search total and retry.
Markdown twins of every page
Every storefront URL has a Markdown version at <url>.md (/en.md for the home page), and the same URL with
Accept: text/markdown returns it too. The proxy rewrites both to one route:
// proxy.ts, inside the language branchconst accept = request.headers.get("accept") ?? "";if (pathname.endsWith(".md") || (accept.includes("text/markdown") && !accept.includes("text/html"))) { const url = request.nextUrl.clone(); url.pathname = `/md${pathname.replace(/\.md$/, "")}`; return NextResponse.rewrite(url);}// Same URL, two representations: caches must key on Accept.const res = NextResponse.next();res.headers.set("Vary", "Accept");return res;
// matcher: skip files, but not .mdexport const config = { matcher: ["/((?!_next|api|md/|.*\\..*).*)", "/(.*\\.md)"] };The route answers Markdown, out of the index, pointing at the HTML page as canonical:
export async function GET(_: Request, { params }: { params: Promise<{ lang: string; path?: string[] }> }) { const { lang, path = [] } = await params; const page = await pageMarkdown("/" + path.map(decodeURIComponent).join("/"), lang); if (!page) return new Response("Not found", { status: 404 }); return new Response(page.body + "\n", { headers: { "content-type": "text/markdown; charset=utf-8", "x-robots-tag": "noindex", link: `<${page.canonical}>; rel="canonical"`, vary: "Accept", }, });}Announce the twin from the HTML page with <link rel="alternate" type="text/markdown">. In Next.js metadata:
alternates: { ...alternates(paths, lang), types: { "text/markdown": `${canonical}.md` } },What a twin contains:
- The page’s facts without markup: name, brand, price incl. and excl. VAT in the page’s market, stock, SKU and GTIN per variant.
- The typed spec sheet as a table: spec, value (with
≤/≥for bounds), UN/CEFACT code, classification codes. - Links to other twins (
[name](https://shop.example/en/path.md)), so a model can walk the catalogue. - Listings as tables of products, with the same prices.
/** The typed spec sheet: value with unit, the unit's UN/CEFACT code, and the ETIM feature (and value) codes. */const specTables = (groups: SpecGroup[], lang: Lang) => groups .map((g) => ({ ...g, rows: g.rows.filter(stated) })) .filter((g) => g.rows.length) .flatMap((g) => [ `### ${g.title}`, "", ...table( ["Spec", "Value", "UN/CEFACT", "ETIM"], g.rows.map((r) => [ r.label, `${r.bound === "max" ? "≤ " : r.bound === "min" ? "≥ " : ""}${r.text}`, r.unitCode ?? "", [r.etim, ...(r.options ?? []).map((o) => o.etim)].filter(Boolean).join(" · "), ]), ), "", ]);
const cell = (s: unknown) => String(s ?? "") .replace(/\|/g, "\\|") .replace(/\s*\n\s*/g, " ");const table = (head: string[], rows: unknown[][]) => [ `| ${head.map(cell).join(" | ")} |`, `|${head.map(() => "---").join("|")}|`, ...rows.map((r) => `| ${r.map(cell).join(" | ")} |`),];Another pattern from a Norwegian build: a Markdown twin per SKU (/produkt/{sku}.md, and ?format=md), via
rewrites() in next.config.ts.
One source of truth
The HTML spec sheet, the JSON-LD additionalProperty, the Markdown table, llms-full.txt and an MCP server’s
product detail all render the same SpecRows. Build them in one module (spec-text.ts), and the five readers
can’t disagree about a value, a unit or whether a feature is stated.
Validating structured data and the crawler’s view
Three layers, each catching what the others miss: the schema.org vocabulary (does every type and property exist,
and fit where it is used), Google’s rules for rich results (which ask for more than schema.org), and what a
crawler actually receives (headers, <head>, robots, sitemap, Markdown).
1. The schema.org vocabulary check
Easy-to-get-wrong properties pass JSON syntax checks and most linters: leaseLength on a Product (it belongs to
Offer), isConsumableFor on an Offer (it belongs to Product), a misspelt inCodeSet, a type that doesn’t
exist. This script reads the official schema.org release file and checks every @type and property on a page,
through the class hierarchy (ProductGroup is a Product, OnlineStore an Organization). Node 20+, no
dependencies. Put it in scripts/ and run it in CI against a deployment or saved HTML.
#!/usr/bin/env node// Checks the JSON-LD on pages against the schema.org vocabulary: every @type must exist, every property must exist// and be allowed on the node's type (domainIncludes, through the class hierarchy). Node 20+, no dependencies.//// node check-schema-org.mjs https://shop.example/en https://shop.example/en/some/product// node check-schema-org.mjs page.html data.jsonld//// Exit code 1 when anything is wrong, so it can gate CI.import { readFile } from "node:fs/promises";
const VOCAB = "https://schema.org/version/latest/schemaorg-current-https.jsonld";const S = "schema:";// Keys that are JSON-LD syntax or Google conventions, not schema.org properties.const IGNORE = new Set(["@context", "@id", "@type", "@graph", "@value", "@language", "query-input"]);
const graph = (await (await fetch(VOCAB)).json())["@graph"];const types = (n) => [n["@type"]].flat();const ids = (v) => [v ?? []].flat().map((x) => x["@id"]);const parents = new Map();const props = new Map();for (const n of graph) { if (types(n).includes("rdfs:Class")) parents.set(n["@id"], ids(n["rdfs:subClassOf"])); if (types(n).includes("rdf:Property")) props.set(n["@id"], { domain: ids(n["schema:domainIncludes"]) });}const ancestors = (t, seen = new Set()) => { if (seen.has(t)) return seen; seen.add(t); for (const p of parents.get(t) ?? []) ancestors(p, seen); return seen;};
async function sources(arg) { const text = /^https?:\/\//.test(arg) ? await (await fetch(arg, { headers: { "user-agent": "schema-check" } })).text() : await readFile(arg, "utf8"); if (arg.endsWith(".json") || arg.endsWith(".jsonld")) return [JSON.parse(text)]; return [...text.matchAll(/<script[^>]*type="application\/ld\+json"[^>]*>([\s\S]*?)<\/script>/g)].map((m) => JSON.parse(m[1]), );}
const problems = [];function walk(node, where) { if (Array.isArray(node)) return node.forEach((n, i) => walk(n, `${where}[${i}]`)); if (!node || typeof node !== "object") return; const own = node["@type"] ? [node["@type"]].flat().map((t) => (t.startsWith("http") ? t.replace(/^https?:\/\/schema\.org\//, S) : S + t)) : []; for (const t of own) if (!parents.has(t)) problems.push(`${where}: unknown type ${t.slice(S.length)}`); const all = new Set(own.flatMap((t) => [...ancestors(t)])); for (const [key, value] of Object.entries(node)) { if (IGNORE.has(key)) continue; const p = props.get(S + key); if (!p) problems.push(`${where}: unknown property ${key}`); else if (own.length && !p.domain.some((d) => all.has(d))) problems.push( `${where}: ${key} is not a property of ${own.map((t) => t.slice(S.length)).join("/")} (domain: ${p.domain.map((d) => d.slice(S.length)).join(", ")})`, ); walk(value, `${where}.${key}`); }}
for (const arg of process.argv.slice(2)) { const blocks = await sources(arg); if (!blocks.length) problems.push(`${arg}: no JSON-LD found`); blocks.forEach((b, i) => walk(b, `${arg}#${i}`));}for (const p of problems) console.log(p);console.log( problems.length ? `${problems.length} problem(s)` : "OK: every type and property is in schema.org and fits its type",);process.exit(problems.length ? 1 : 0);node scripts/check-schema-org.mjs https://shop.example/en https://shop.example/en/some/productnode scripts/check-schema-org.mjs page.html structured-data.jsonldWhat it reports (a deliberately broken sample):
bad.jsonld#0: leaseLength is not a property of Product (domain: Accommodation, Offer, RealEstateListing)bad.jsonld#0: unknown property colourbad.jsonld#0.offers: isConsumableFor is not a property of Offer (domain: Product)bad.jsonld#0.brand: unknown type Brandd4 problem(s)- It checks names and domains, not value types (
rangeIncludes) or Google’s required fields. query-inputon aSearchActionis a Google convention, not a schema.org property; the script ignores it.- Pick sample URLs from the sitemap so every page type is covered: home, a category, a brand, a product with variants, a product without, a rental, an article.
- Fetching a page with a plain user agent tests what browsers get. To test a crawler’s copy, add the crawler’s
user agent to the
fetchheaders.
2. Google’s rules
The Rich Results Test and the Merchant listing reports check what
Google needs for product snippets and merchant listings: offers with price and priceCurrency, availability,
and recommended shippingDetails, hasMerchantReturnPolicy, aggregateRating/review. Treat its warnings as
questions, not orders: add a return policy or shipping details only if the store has them, and never a rating
without reviews. The Schema Markup Validator shows the parsed graph, useful for
@id links between nodes.
3. The crawler’s view, with curl
Run these against the deployment, not a local next start:
SITE=https://shop.exampleGB='Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; Googlebot/2.1; +http://www.google.com/bot.html) Chrome/138.0.0.0 Safari/537.36'
# robots.txt: AI crawler block, Content-Signal, private routes, sitemapcurl -s $SITE/robots.txt
# sitemap: count URLs and hreflang alternatescurl -s $SITE/sitemap.xml | grep -c '<loc>'curl -s $SITE/sitemap.xml | grep -c 'xhtml:link'
# llms.txt and a Markdown twin, both wayscurl -sI $SITE/llms.txt | grep -i content-typecurl -sI $SITE/en/some/product.md | grep -i 'content-type\|x-robots-tag\|^link\|^vary'curl -s -H 'Accept: text/markdown' $SITE/en/some/product | head -20
# <head> as Googlebot sees it (see crawlers.md for the loop over every user agent)curl -s -A "$GB" $SITE/en/some/product | head -c 6000 | grep -o '<title>[^<]*</title>'Expect text/markdown with x-robots-tag: noindex, a canonical Link header and Vary: Accept on the
Markdown twin; a <title> before </head> for every user agent.
4. Ask an answer engine
The end-to-end test: ask ChatGPT, Claude or Perplexity (with browsing) for a product’s voltage, weight and price
incl. VAT in a given market, and for the store’s llms.txt. Wrong or missing answers usually point at metadata
outside <head>, a disallowed path, or a fact that is only in client-rendered HTML.
What to automate
- The vocabulary check on a sample of sitemap URLs, after each deploy.
- The
<head>check per user agent on a product and a category URL. - A test that no spec
PropertyValuehasvalue: false(unset booleans readfalseand should have been left out;valueAddedTaxIncluded: falseis fine). - A test that hreflang in the sitemap matches the translated paths from Discovery.
Crystallize AI