Nesting schema Markup (@id và @graph)

Đó deep-dive on connecting JSON-LD entities với @id và @graph — ổn định identifiers, đó hai canonical node patterns (WebSite→Bài viết→Tác giả, Sản phẩm→Offer→Organization), đó three mistakes đó break đó graph, và đó honest limits of điều gì Google tài liệu xác nhận.

Xuất bản lần đầu: 2 thg 7, 2026 · Cập nhật lần cuối: 8 thg 8, 2026 · Advanced
Ngôn ngữ

Nesting connects của bạn JSON-LD entities thay vì dumping them as disconnected chặn. @id là một ổn định, unique URI (thường một canonical URL plus một #fragment) đó names an entity so other entities có thể reference điều này — an Bài viết tác giả pointing tại một Person node, một Sản phẩm Offer pointing tại an Organization/seller — thay vì re-declaring đó đầy đủ entity mọi nơi. @graph là một từ khóa đó bundles những connected entities vào một script block. Google tài liệu xác nhận cả hai nesting và riêng lẻ items hoạt động, và đó @id là cách bạn tell Google hai items là linked, nhưng they không bao giờ xác nhận liệu @id resolves trên các trang — so đó safe default là consistent @id các giá trị plus đó hoàn tất entity graph on mỗi trang đó cần điều này. Hai patterns để learn: WebSite → WebPage → Bài viết → Tác giả cho xuất bản, Sản phẩm → Offer → Organization cho ecommerce. Three ways điều này breaks hoặc costs bạn: inconsistent/non-unique @id các giá trị, orphaned references (an @id cited nhưng không bao giờ declared — một semantic khoảng trống, không hợp lệ JSON-LD), và duplicating một đầy đủ entity declaration mọi nơi thay vì referencing điều này (một maintenance trap; giống nhau-entity repeats hợp nhất thay vì theo nghĩa đen break, nhưng một genuinely conflicting reused @id là một real break). đây là an entity-understanding tool, không một xếp hạng hoặc rich-kết quả lever by itself.

Tóm tắt — Nesting connects JSON-LD entities qua @id ( ổn định, unique URI — thường canonical URL plus #fragment) so bạn reference entity thay vì re-declaring nó, và @graph ( từ khóa bundling connected entities vào một script block). tài liệu củ Google xác nhận cả hai nesting và riêng lẻ items hoạt động, và đó bạn sử dụng @id để link related items — nhưng họ không bao giờ xác nhận liệu @id resolves trên các trang, so safe default là consistent @id các giá trị plus hoàn tất entity graph on mỗi trang đó cần nó. Learn hai patterns: WebSite → WebPage → Article → Author (xuất bản) và Product → Offer → Organization/seller (ecommerce). Three thất bại modes để watch cho: inconsistent/non-unique @id các giá trị, orphaned references ( @id cited nhưng không bao giờ declared — semantically incomplete, không hợp lệ JSON-LD), và duplicate đầy đủ declarations của giống nhau entity ( maintenance trap; giống nhau-entity repeats hợp nhất dưới JSON-LD’s node rules, nhưng reusing một @id cho genuinely khác entities là thực conflict). nó entity-understanding tool — disambiguation và de-duplication — không xếp hạng hoặc rich-kết quả lever by itself.

Evidence for this claim JSON-LD supports connected nodes via nesting or @id references, allowing multiple related entities to form one graph. Scope: JSON-LD graph model. Confidence: high · Verified: W3C JSON-LD 1.1 Evidence for this claim Google requires structured data to represent visible page content and follow each feature's specific nesting and property guidelines; extra valid nodes do not create eligibility by themselves. Scope: Current Google structured-data general guidelines. Confidence: high · Verified: Google Search Central: Structured data general guidelines

Phạm vi: Đây là deep-dive, không intro

điều này bài viết assumes bạn đã know Điều gì JSON-LD là và Vì sao nó được khuyến nghị format — schema markup trang covers đó, và nó introduces @id/@graph tại glance. điều này trang là deferred deep-dive: thực tế mechanics, tiêu chuẩn node patterns, và cụ thể mistakes đó âm thầm break graph. nếu bạn muốn format basics hoặc nơi để place <script> block, JSON-LD là sibling cho đó.

@id — ổn định identifier, không fetchable URL

@id assigns unique URI để JSON-LD entity so khác entities có thể point tại nó by reference. convention — consistent trên mỗi credible nguồn I’ve checked — là absolute canonical URL plus descriptive fragment:

"@id": "https://example.com/#organization"
"@id": "https://example.com/#website"
"@id": "https://example.com/team/jane-doe/#person"

Hai điều mọi người nhận sai ở đây:

  • Điều này không có để resolve. Theo đó JSON-LD spec, @id’s job là node identification — một unique, ổn định “name” cho an entity — không fetchability. Dùng một fragment on của bạn own domain là tiêu chuẩn practice và không require đó fragment URL để independently load as một trang. Sitebulb node-identifiers hướng dẫn frames điều này well: một node identifier là “a unique ‘name’ for an entity, which is publicly accessible and can be looked up or linked to.” (bản dịch) «một unique ‘name’ cho an entity, mà là publicly accessible và có thể là looked lên hoặc linked để.»
  • @id không phải url. họ là khác nhau properties đang làm khác nhau jobs. @id identifies đó node trong đó graph; url mô tả một real, fetchable trang về đó entity. An Organization có thể (và thường nên) có cả hai — an @id of https://example.com/#organization và một url of https://example.com/.

@id các giá trị là case-sensitive#Organization#organization là hai khác entities. Pick convention và không bao giờ drift từ nó.

@graph — bundling connected entities vào một block

@graph là JSON-LD từ khóa đó lets bạn put multiple top-cấp độ entities vào một array bên trong single <script type="application/ld+json"> block, với entities cross-referencing mỗi khác by @id:

{
  "@context": "https://schema.org",
  "@graph": [
    { "@type": "Organization", "@id": "https://example.com/#organization", "...": "..." },
    { "@type": "WebSite", "@id": "https://example.com/#website", "...": "..." },
    { "@type": "WebPage", "@id": "https://example.com/post/#webpage", "...": "..." }
  ]
}

@graph là một container, không một requirement. Bạn có thể absolutely dùng tách biệt <script> chặn cho riêng lẻ items — Google tài liệu xác nhận cả hai approaches hoạt động. Đó reason để reach cho @graph là maintainability: khi bạn có three hoặc hơn cross-referencing entities, bạn ghi @context khi tại đó top thay vì repeating điều này trong mỗi block, và mọi thứ đó references mọi thứ khác lives trong một place. Này là đó pattern Yoast dùng trong production — của nó schema architecture tài liệu giải thích đó một shared graph lets them “avoid having to duplicate or repeat shared properties, and to reduce the amount of code/processing/overhead required.” (bản dịch) «tránh có để duplicate hoặc repeat shared properties, và để reduce đó amount of code/processing/overhead bắt buộc.»

Vì sao nest tại all — và Điều gì Google thực ra nói

Declare each entity once and connect the graph with stable `@id` references instead of repeating full blocks.

One Organization identified as hash organization is referenced as publisher by the WebSite and Article. The WebPage belongs to the WebSite and is connected to the Article. Each entity is declared once, and the same stable at-id string is reused for every reference.

Google documents hai structural options và xác nhận điều này understands cả hai. Từ đó Chung Dữ liệu có cấu trúc Guidelines: “Google Search understands multiple items on a page, whether you nest the items or specify each item individually.” (bản dịch) «Google Search understands multiple items on một trang, liệu bạn nest đó items hoặc specify mỗi item individually.» Điều này defines them plainly — nesting“when there is one main item, and additional items are grouped under the main item” (bản dịch) «khi có một main item, và additional items là grouped dưới đó main item», và riêng lẻ items“when each item is a separate block on the same page.” (bản dịch) «khi mỗi item là một tách biệt block on đó cùng trang.»

Đó một paragraph đó là đó closest điều để an chính thức rationale cho @id là này: “If there are items that are more helpful when they are linked together (for example, a recipe and a video), use @id in both the recipe and the video items to specify that the video is about the recipe on the page. If you didn’t link the items together, Google Search may not know that it can show the video as a Recipe rich result.” (bản dịch) «Nếu có items đó là hơn helpful khi they là linked together (ví dụ, một recipe và một video), dùng @id trong cả hai đó recipe và đó video items để specify đó video là về đó recipe on đó trang. Nếu bạn đã không link đó items together, Google Search có thể không know đó điều này có thể cho thấy đó video as một Recipe rich kết quả.» đó là đó mechanism trong Google own words — @id là cách bạn tell Google hai items belong together.

Worth honest note: tài liệu củ Google state điều này principle trong prose nhưng không ship worked @graph+@id đoạn mã mẫu demonstrating nó — của họ code các ví dụ hiển thị nested Recipe và hai riêng lẻ top-cấp độ items, neither của mà thực ra cross-references by @id. các ví dụ dưới fill đó khoảng trống.

điều này connects trực tiếp để schema hai jobs ( cách diễn đạt từ schema markup trang): nesting well là squarely entity-understanding move — disambiguation và avoiding contradictory/duplicated dữ liệu — không rich-kết quả trigger on của nó own. Linking của bạn Article cleanly để của nó Author không unlock new SERP feature; nó chỉ làm relationships unambiguous.

Pattern 1 — trang web → WebPage → Bài viết → Tác giả

canonical xuất bản pattern. Một Organization ( publisher), một WebSite, sau đó theo-trang WebPageArticle on nó, với authorpublisher resolved by @id thay vì re-declared:

{
  "@context": "https://schema.org",
  "@graph": [
    {
      "@type": "Organization",
      "@id": "https://example.com/#organization",
      "name": "Example Media",
      "url": "https://example.com/",
      "logo": "https://example.com/logo.png",
      "sameAs": [
        "https://www.linkedin.com/company/example-media/",
        "https://en.wikipedia.org/wiki/Example_Media"
      ]
    },
    {
      "@type": "WebSite",
      "@id": "https://example.com/#website",
      "url": "https://example.com/",
      "name": "Example Media",
      "publisher": { "@id": "https://example.com/#organization" }
    },
    {
      "@type": "WebPage",
      "@id": "https://example.com/nesting-schema/#webpage",
      "url": "https://example.com/nesting-schema/",
      "name": "Nesting Schema Markup",
      "isPartOf": { "@id": "https://example.com/#website" }
    },
    {
      "@type": "Person",
      "@id": "https://example.com/team/jane-doe/#person",
      "name": "Jane Doe",
      "url": "https://example.com/team/jane-doe/",
      "sameAs": ["https://www.linkedin.com/in/jane-doe/"]
    },
    {
      "@type": "Article",
      "@id": "https://example.com/nesting-schema/#article",
      "mainEntityOfPage": { "@id": "https://example.com/nesting-schema/#webpage" },
      "headline": "Nesting Schema Markup",
      "author": { "@id": "https://example.com/team/jane-doe/#person" },
      "publisher": { "@id": "https://example.com/#organization" }
    }
  ]
}

Note Điều gì happening: authorpublisher là một-line references. PersonOrganization là declared sau khi mỗi. Article hangs off WebPage (mainEntityOfPage), mà là isPartOf WebSite, mà là publisher-ed by Organization. đó connected graph, không five islands.

Pattern 2 — Sản phẩm → Offer → Organization (seller)

ecommerce tương đương, và nơi nesting earns của nó giữ tại quy mô: thay vì re-declaring của bạn merchant Organization on mỗi một của thousands của sản phẩm các trang, declare nó sau khi và reference nó as seller:

{
  "@context": "https://schema.org",
  "@graph": [
    {
      "@type": "Organization",
      "@id": "https://shop.example.com/#organization",
      "name": "Example Shop",
      "url": "https://shop.example.com/",
      "logo": "https://shop.example.com/logo.png"
    },
    {
      "@type": "Product",
      "@id": "https://shop.example.com/widget/#product",
      "name": "Deluxe Widget",
      "sku": "WIDGET-001",
      "brand": { "@type": "Brand", "name": "Example" },
      "offers": {
        "@type": "Offer",
        "price": "29.99",
        "priceCurrency": "USD",
        "availability": "https://schema.org/InStock",
        "seller": { "@id": "https://shop.example.com/#organization" }
      }
    }
  ]
}

Offer’s seller points tại shared Organization node. giống nhau seller entity, một declaration, referenced từ mỗi sản phẩm. (cho rất lớn variant sets, giống nhau shared-@id ý tưởng extends để ProductGroup với variant Products — đó specialization của điều này pattern, không khác mechanism.)

three mistakes đó break graph

Này là đó practical heart of an audit. Khi nesting “doesn’t work,” (bản dịch) «không hoạt động,» đây là gần như luôn một of những three.

1. Inconsistent hoặc non-unique @id các giá trị

giống nhau entity được cho khác @id strings trên các trang (hoặc trên replatform/migration), so các công cụ tìm kiếm và các validator see them as unrelated entities thay vì một. hoặc opposite — reusing một @id cho hai genuinely khác entities. khắc phục là strict, được ghi lại convention (e.g. {base-url}/#organization, {page-url}/#webpage, {profile-url}/#person) applied mechanically. Case được tính; #author#Author.

2. Orphaned references

An @idreferenced nhưng không bao giờ declared. Bạn ghi "author": {"@id": "https://example.com/#person-jane"}, nhưng không node anywhere trong đó tested document thực ra declares đó @id với một @type và properties. Worth đang precise ở đây: một bare {"@id": "..."} object — điều gì đó JSON-LD spec calls một node reference (“a node object used to reference a node having only the @id key” (bản dịch) «một node object được dùng để reference một node có chỉ đó @id key») — là hợp lệ JSON-LD syntax on của nó own; điều này không một parse lỗi. Đó vấn đề là semantic và consumer-cụ thể: đó dự kiến connection — “this Article’s author is that Person” (bản dịch) «này Bài viết tác giả là đó Person» — không bao giờ resolves để bất cứ điều gì hữu ích, so bất kỳ feature hoặc reader đó needed đó tác giả thực tế name, URL, hoặc sameAs dữ liệu xuất hiện lên empty. Này là đó sneaky một: các validator thường vẫn parse mỗi declared item không có erroring, so không có gì screams tại bạn. Bạn ship an incomplete graph và không bao giờ notice. Momentic @id hướng dẫn catalogs này as một of đó hầu hết phổ biến thực tế nesting failures.

3. Duplicate đầy đủ declarations của giống nhau entity

opposite của orphaning: re-declaring hoàn tất Organization/Person object inline on mỗi trang thay vì referencing nó sau khi. Hai khác điều có thể happen ở đây, và nó worth telling them apart:

  • Repeated declarations of đó genuinely giống nhau entity. Theo đó JSON-LD spec, “the properties of a node in a graph may be spread among different node objects within a document. When that happens, the keys of the different node objects need to be merged to create the properties of the resulting node.” (bản dịch) «đó properties of một node trong một graph có thể là spread among khác nhau node objects trong một document. Khi đó happens, đó keys of đó khác nhau node objects cần để là đã hợp nhất để tạo đó properties of đó resulting node.» So repeating đó giống nhau @id với đó giống nhau (hoặc compatible) dữ liệu không một parse failure — processors hợp nhất điều này. Đó không làm điều này một good ý tưởng: đây là vẫn điều gì nesting tồn tại để ngăn, và điều này bloats markup và tạo một maintenance trap — cập nhật của bạn address hoặc logo trong một template, forget đó other forty, và đó entity hiện tại contradicts itself trên đó site. Cả hai Ahrefs’ schema coverage và Schema App independently làm đó giống nhau “change one and forget the others” (bản dịch) «thay đổi một và forget đó others» point.
  • Đó giống nhau @id reused cho hai thực ra khác nhau entities. Này là đó real break: hai node objects share an identifier nhưng mô tả conflicting điều (một khác nhau name, một khác nhau logo, một khác nhau @type). đó là một semantic conflict, không một harmless hợp nhất — pick một distinct @id cho mỗi genuinely tách biệt entity.

Declare sau khi, reference mọi nơi — maintenance case cho đang làm so holds either way, mặc dù giống nhau-entity repeat sẽ không technically break graph way orphaned reference hoặc genuinely conflicting @id sẽ.

unresolved câu hỏi: làm @id resolve trên các trang?

Ở đây đó honest limit đó separates một real câu trả lời từ đó confident-nhưng-sai version. Google tài liệu không bao giờ explicitly trạng thái liệu @id references resolve trên các trang — e.g., một sản phẩm trang Offer.seller pointing tại an Organization node đó là declared chỉ on đó homepage. Không Google Search Central document dùng “cross-trang” hoặc “across pages” (bản dịch) «trên các trang» trong relation để @id.

Đó một nearby tín hiệu points toward self-contained các trang: Google khuyến nghị, cho duplicate nội dung, “placing the same structured data on all page duplicates, not just on the canonical page” (bản dịch) «placing đó giống nhau dữ liệu có cấu trúc on all trang duplicates, không chỉ on đó canonical trang» — mà implies dữ liệu có cấu trúc là evaluated theo trang, không fetched từ elsewhere. Và có không on-đó-record statement từ một named Google hoặc Bing rep (Mueller, Illyes, Splitt) cụ thể resolving đó cross-trang @id câu hỏi đó I có thể verify. Bing, cho của nó part, có JSON-LD validation trong Quản trị viên web Tools nhưng không published @id/@graph-cụ thể hướng dẫn tại all — một genuine tài liệu khoảng trống, không một position I’m going để invent cho them.

So, as of July 2026, treat “Google follows @id links across pages” (bản dịch) «Google follows @id links trên các trang» as an ngành inference, không một confirmed behavior. Đó safe default — mà Yoast, Momentic, và Schema App all converge on independently — là: giữ @id các giá trị consistent cho đó giống nhau entity mọi nơi, nhưng vẫn output đó hoàn tất entity graph on mỗi trang đó cần điều này. không assume Google sẽ fetch một referenced entity từ một khác nhau URL. Yoast production lựa chọn là chính xác này: điều này emits đó đầy đủ graph on mỗi trang thay vì relying on cross-trang resolution.

Cách validate nested schema

Hai tools:

  • Rich Kết quả Kiểm thử — trong practitioner kiểm thử as của July 2026, nó parses @graph arrays và resolves @id references trong tested document: Khi entity references B by @id và B là declared trong giống nhau graph, họ hiển thị as connected; Khi referenced @id là không bao giờ declared trong tested markup, tool vẫn parses declared items individually không có erroring, nhưng có thể’t hiển thị connection. Google không document điều này UI behavior explicitly anywhere I có thể tìm, so treat nó as observed, reproducible tool behavior thay vì chính thức đặc tả — và re-kiểm tra nó nếu tool UI thay đổi. đó behavior là chính xác Vì sao orphaned references slip qua — không lỗi, chỉ bị thiếu link.
  • Schema Markup Validator — schema.org own vocabulary validator, ít hơn opinionated về Google supported rich-kết quả types.

Kiểm thử được kết xuất trang, không chỉ của bạn template nguồn — nếu JSON-LD là injected qua JavaScript, xác nhận nó thực ra present. Google documents reading JSON-LD đó dynamically injected by JavaScript, nhưng đó cụ thể để Google — JavaScript-execution behavior varies by crawler và sản phẩm, và có không blanket rule đó mỗi AI crawler renders JS giống nhau way (hoặc tại all). Shipping JSON-LD trong ban đầu HTML thay vì assuming nó’ll là executed là conservative lựa chọn — đó schema-markup-cho-AI concern.

Myths worth killing

  • @id needs to be a real, live, fetchable URL.” (bản dịch) «@id cần để là một real, trực tiếp, fetchable URL.» Không — by convention đây là một canonical URL plus một fragment, nhưng của nó function là identification, không fetchability. Đó fragment không cần để resolve để của nó own trang.
  • “Same @id on different pages auto-merges those entities in Google’s index, like a canonical tag consolidates pages.” (bản dịch) «Giống nhau @id on khác nhau các trang auto-merges những entities trong Google chỉ mục, như một canonical tag consolidates các trang.» Không confirmed by bất kỳ Google doc. Consistent @id là good hygiene, không một proven cross-trang consolidation mechanism.
  • “You must use @graph; separate script blocks are wrong.” (bản dịch) «Bạn phải dùng @graph; tách biệt script chặn là sai.» Sai. Google understands cả hai. @graph là một maintainability lựa chọn.
  • “More nesting always improves entity understanding.” (bản dịch) «Hơn nesting luôn improves entity understanding.» Chỉ nếu đó entities là genuinely related. Nesting unrelated items (Schema App ví dụ: an unrelated Event dưới một Recipe) không help và có thể muddy các tín hiệu.
  • @id/@graph structure is a ranking or rich-result factor.” (bản dịch) «@id/@graph structure là một xếp hạng hoặc rich-kết quả factor.» Không. Của nó giá trị là disambiguation và reduced duplication — consistent với schema không đang một xếp hạng factor tại all.
  • “An undeclared @id is harmless; engines just ignore it.” (bản dịch) «An undeclared @id là harmless; engines chỉ bỏ qua điều này.» đó là đó orphaned-reference failure — đó dự kiến connection silently không form, và tools thường không lỗi, so bạn ship điều này unnoticed.

nơi điều này sits

Đây là Cách-để layer dưới dữ liệu có cấu trúc hub, deeper sibling của schema markup (mà introduces @id/@graph) và JSON-LD ( format). nó leans on giống nhau entity-understanding thinking as entitiesschema markup cho AI — well-được xây dựng graph là entity infrastructure, liệu consumer là Google Knowledge Graph hoặc LLM. toàn bộ sub-cluster lives bên trong on-trang SEO.

Add an expert note

Pin an expert quote

New person? Create their unclaimed profile at /admin/experts/ → Pin a quote first.