Reference - This guide is a tutorial. For exhaustive, always-current signatures and field lists, see the auto-generated reference:

Prerequisites


1. Render the graph

Every article, page, product, product collection and product category read carries its resolved schema.org graph in structuredData.graph, an array of nodes. renderJsonLdGraph() turns it into one <script type="application/ld+json"> tag:

tsx
// app/blog/[slug]/page.tsx
import { renderJsonLdGraph } from 'lynkow'
import { lynkow } from '@/lib/lynkow'

export default async function BlogPost({ params }: { params: Promise<{ slug: string }> }) {
  const { slug } = await params
  const content = await lynkow.contents.getBySlug(slug)

  return (
    <>
      <div dangerouslySetInnerHTML={{ __html: renderJsonLdGraph(content.structuredData?.graph) }} />
      <article>
        <h1>{content.title}</h1>
        <div dangerouslySetInnerHTML={{ __html: content.body }} />
      </article>
    </>
  )
}

renderJsonLdGraph() returns '' for an empty or missing graph. It puts every node under one @context and one @graph, and escapes <, >, &, U+2028 and U+2029, so no value can close the tag. Never write the graph into a <script> with a plain JSON.stringify().

The other records render the same way:

Record

Graph

Page

page.structuredData?.graph from lynkow.pages.getBySlug()

Product, collection, product category

structuredData?.graph from products.getBySlug(), productCollections.getBySlug(), productCategories.getBySlug()

Any path of a catch-all route

resolved.structuredData.graph from lynkow.paths.resolve() (Guide 9)

The commerce reads need a client created with a publishableKey (Guide 18). List reads such as products.list() carry no graph.

lynkow.pages.getJsonLd(slug) returns a page's graph alone, without the page.

With @lynkow/next, server.JsonLdScript renders the same graph and puts its URLs on your site's public form. Pass the locale the record was served in:

tsx
// `locale` is the locale your route read the product in
<server.JsonLdScript nodes={product.structuredData?.graph} locale={product.locale ?? locale} />

2. The cascade

Lynkow stores JSON-LD nodes at several levels and merges them into the graph of each page:

Site                     <- Organization, WebSite: on every page
  +-- Article category   <- LocalBusiness, Service: on every article of the category
  |     +-- Article
  +-- Page
  +-- Product category   <- on the category page and on every product filed in it
  |     +-- Product
  +-- Product collection

Each level holds jsonLdGraph, the nodes it declares, and jsonLdExclusions, the id values of parent or automatic nodes it removes. For a given page, the graph is:

  1. The site's nodes, minus those the category or the page excludes.

  2. The category's nodes, minus those the page excludes.

  3. The page's own nodes.

  4. The automatic nodes of section 4, minus those the category or the page excludes.

A node that reuses the id of a node from a higher level replaces it. An article inherits from one category, the one its URL is built under.

On a storefront:

  • A product inherits from the product category it is filed in, even when that category is hidden on the storefront, and never from that category's parents.

  • A product category's exclusions apply to its own page and to the page of every product filed in it. Excluding auto:breadcrumb on a category removes the breadcrumb from both.

  • A category page does not inherit from its parent category, and a product page never carries its collection's nodes.

Where each level is configured

The site level is in Settings > SEO > JSON-LD. Every other level is in the JSON-LD structured data section of the record's editor: article, article category, page, product, collection or product category. The editor shows the inherited nodes with an exclude toggle, the nodes of the current level, and a preview of the merged graph.

The MCP tools write the same fields: seo_write action update_settings for the site, content_write and site_block_write action update, and the update actions of the commerce tools. See MCP Tools.

@id values

Each node's rendered @id is its id behind a URL:

  • Site and category nodes: <site-url>#<id>, the same on every page that includes them.

  • Page, article and commerce record nodes, and automatic nodes: <page-url>#<id>.

Give each node an id. Without one, Lynkow derives it from the node's content, so the @id changes when the content does.

To point one node at another, use its id alone ("site-org"): Lynkow rewrites it to the rendered @id. An absolute URL is kept as written.


3. Declare a node

A node is { id, type, source, data }. With source: 'preset', type names one of the typed presets and data holds its fields. Lynkow fills an empty field from the page (URL, locale, default author):

JSON
{
  "tool": "seo_write",
  "input": {
    "siteId": "<your-site-uuid>",
    "action": "update_settings",
    "jsonLdGraph": [
      {
        "id": "site-org",
        "type": "Organization",
        "source": "preset",
        "data": { "name": "Acme Agency", "url": "https://acme.example", "logo": "https://acme.example/logo.png" }
      }
    ]
  }
}

The 28 presets:

  • Site: WebSite, Organization, Publisher, BreadcrumbList.

  • Page and category: WebPage, AboutPage, ContactPage, CollectionPage, LocalBusiness, Service.

  • Article: Article, BlogPosting, NewsArticle, HowTo, Product, Recipe, Event, Course, VideoObject, CaseStudy, FAQPage, SoftwareApplication, JobPosting, Review, AggregateRating, ProfilePage, QAPage.

  • Several nodes: Reviews (section 5).

A preset passes through any extra schema.org property in data, such as openingHoursSpecification on a LocalBusiness.

For a type with no preset, use source: 'custom' and a complete schema.org object as data. Lynkow emits it as written, adding @context and @id:

JSON
{
  "id": "episode-42",
  "type": "PodcastEpisode",
  "source": "custom",
  "data": { "@type": "PodcastEpisode", "name": "Episode 42", "episodeNumber": 42, "duration": "PT45M" }
}

Rules on every level:

  • An id cannot start with auto:.

  • data is a plain object, without __proto__, constructor or prototype keys.

  • At most 50 nodes and 50 exclusions per level.


4. Automatic nodes

Lynkow adds these nodes without any configuration. Remove one by adding its id to jsonLdExclusions, then declare your own node under another id if you want a replacement.

id

Emitted on

Built from

auto:article

Article

Title, description, dates, author, featured image

auto:faqpage

Article with an enabled FAQ block

The FAQ questions and answers of the body

auto:webpage

Page

The page's name, SEO fields and URL

auto:breadcrumb

Article, page

The URL path

auto:breadcrumb

Product, product category

The category chain, root first, without a Home item

auto:product

Product

Title, description, images, price, availability, identifiers

auto:collectionpage

Collection, product category

The first 20 published products, newest first

Lynkow never adds an Organization: declare it at the site level, as in section 3.

On a commerce page:

  • auto:product carries one Offer, or an AggregateOffer with lowPrice and highPrice when the variants have different prices. availability is InStock or OutOfStock, and is left out on a bookable product.

  • auto:product carries an aggregateRating when an approved review is linked to the product.

  • A product's breadcrumb appears only when its category is visible on the storefront. A root category and a collection have none.

  • The automatic nodes carry inLanguage and their text in the locale served. The site's nodes are read in that locale too (section 6). A product's, a collection's and a category's own nodes are the same in every locale.

To make your own Product the main entity of an article, exclude auto:article on that article:

JSON
{
  "jsonLdGraph": [
    { "id": "house-wine", "type": "Product", "source": "preset", "data": { "name": "House wine" } }
  ],
  "jsonLdExclusions": ["auto:article"]
}

5. Reviews in the graph

The Reviews preset emits one schema.org Review per approved review of the site, newest first, each pointing at a parent entity through itemReviewed. Add it to the page that lists your reviews:

JSON
{
  "tool": "site_block_write",
  "input": {
    "siteId": "<your-site-uuid>",
    "action": "update",
    "slug": "reviews",
    "jsonLdGraph": [
      {
        "id": "reviews-section",
        "type": "Reviews",
        "source": "preset",
        "data": { "itemReviewedId": "site-org", "limit": 20 }
      }
    ]
  }
}

Field

Default

Meaning

itemReviewedId

required

The id of the reviewed entity ("site-org"), or an absolute @id

limit

50

Number of reviews, at most 200

minRating

1

Lowest rating included, 1 to 5

localeFilter

false

true keeps only the reviews in the page's locale

Each Review carries the author's name, the date, the rating, the text, the title when there is one, and inLanguage. Pending and rejected reviews and private fields never appear.

Star ratings on the parent

Google shows stars from an aggregateRating on a LocalBusiness, Organization or Product. These three presets accept aggregateRatingAuto: true: Lynkow then adds an aggregateRating with the average (ratingValue, one decimal) and the count (ratingCount) of the site's approved reviews.

JSON
{
  "id": "site-org",
  "type": "LocalBusiness",
  "source": "preset",
  "data": { "name": "Example Agency", "aggregateRatingAuto": true }
}

With no approved review, the aggregateRating is left out. An aggregateRating object written in data wins over aggregateRatingAuto.


6. Site nodes per locale

On a multi-language site, a non-default locale can override the content of the site's nodes, an Organization description in that language for example. An override names a site node by its id, and its data is merged over that node's. Every page served in that locale gets the overridden nodes, a fallback page included.

Set it from the locale picker of Settings > SEO > JSON-LD, with PUT /v1/site/settings/translations/seo.json_ld_graph/{locale}, or with the translation_write MCP tool:

JSON
{
  "tool": "translation_write",
  "input": {
    "siteId": "<your-site-uuid>",
    "action": "upsert",
    "resource": "setting",
    "key": "seo.json_ld_graph",
    "locale": "fr",
    "fields": { "graph": [{ "id": "site-org", "data": { "description": "Agence web basée à Lyon" } }] }
  }
}

Articles, categories and pages keep one graph per translation.


7. Add nodes from your frontend

To add nodes Lynkow does not know about, such as reviews from another service, merge them into the server graph with mergeIntoGraph():

tsx
import { renderJsonLdGraph, mergeIntoGraph } from 'lynkow'
import { lynkow } from '@/lib/lynkow'

export default async function ReviewsPage() {
  const page = await lynkow.pages.getBySlug('reviews')
  const external = await fetchExternalReviews() // your own source

  const nodes = external.map((r) => ({
    '@type': 'Review',
    // Prefix with the page URL so the @id is unique on the site
    '@id': `https://example.com/reviews#external-${r.id}`,
    'author': { '@type': 'Person', 'name': r.author },
    'reviewRating': { '@type': 'Rating', 'ratingValue': r.rating, 'bestRating': 5 },
    // Reference the server's entity by its @id, never a copy of it
    'itemReviewed': { '@id': 'https://example.com/#site-org' },
  }))

  return (
    <div dangerouslySetInnerHTML={{ __html: renderJsonLdGraph(mergeIntoGraph(page.structuredData?.graph, nodes)) }} />
  )
}

mergeIntoGraph() appends your nodes after the server's and accepts null or undefined on either side. It logs a warning when one of your @id values is already in the server graph and keeps both nodes: Google merges two entities that share an @id, which can duplicate properties such as aggregateRating.


8. Things to know

  • FAQ must be visible. Google treats FAQ structured data that is not on the page as spam. An FAQ block in the article body is rendered and emitted from the same source. A FAQPage node you declare yourself needs its questions and answers in the page markup too.

  • Edits and caching. If your site caches pages, refresh them from a webhook when a record or the SEO settings change (Guide 11).

  • Older fields. An article also carries structuredData.article.jsonLd and structuredData.faq.jsonLd. The graph already contains them as auto:article and auto:faqpage, so render the graph alone.


Next Steps