I try to implement a JSON-LD breadcrumb for a web site with the following structure:
Home
Topic A (No content)
Article A1
Article A2
Topic B (No content)
Article B1
Article B2
Topic C (No content)
Article C1
Article C2
My problem is that all pages on level 2 (Topic A/B/C) are empty pages that can not be reached by the main navigation. People should not navigate to "Topic A" etc.
How can I express this behavior in my JSON-LD breadcrumb?
This is what my JSON-LD looks like for page "Article A1":
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [{
"@type": "ListItem",
"position": 1,
"name": "Home",
"item": "https://example.com/"
},{
"@type": "ListItem",
"position": 2,
"name": "Topic A",
"item": ""
},{
"@type": "ListItem",
"position": 3,
"name": "Article A1",
"item": "https://example.com/topic-a/article-a1"
}]
}
When I try to validate the above code with https://search.google.com/structured-data/testing-tool it always complains:
itemListElement
@type ListItem
position 2
name Topic A
item Field item requires a value.
Specifying anything else than a URL will result in:
Value for field item must be a valid URL.
How can I describe that 2nd level pages are not reachable by a URL using JSON-LD?
The point of breadcrumbs is to see the current page in the hierarchy, and to navigate to its parent pages. Page-less entries shouldn’t appear there, because they can’t be navigated to.
Schema.org’s BreadcrumbList
type is only meant for web pages (but such a page-less topic isn’t a web page, of course):
A BreadcrumbList is an ItemList consisting of a chain of linked Web pages, typically described using at least their URL and their name, and typically ending with the current page.
This is also what Google requires for their Breadcrumbs rich result (in case you want to get this feature):
A user can navigate all the way up in the site hierarchy, one level at a time, by starting from the last breadcrumb in the breadcrumb trail.
So, you could either omit the page-less topics in the BreadcrumbList
, or make them actual pages.
If you don’t want them to exist as pages, you could still convey what the topic is (see example with about
below), but I wouldn’t expect this data to get used by consumers that are interested in your breadcrumbs:
{
"@context": "http://schema.org",
"@type": "BreadcrumbList",
"itemListElement":
[
{
"@type": "ListItem",
"position": 1,
"item":
{
"@id": "https://example.com/",
"@type": "WebPage",
"name": "Home"
}
},
{
"@type": "ListItem",
"position": 2,
"item":
{
"@id": "https://example.com/article-a1",
"@type": "WebPage",
"name": "Article A1",
"about": {
"@type": "Thing",
"name": "Topic A"
}
}
}
]
}
HTML+RDFa:
<ol typeof="schema:BreadcrumbList">
<li property="schema:itemListElement" typeof="schema:ListItem">
<a property="schema:item" typeof="schema:WebPage" href="https://example.com/">
<span property="schema:name">Home</span>
</a>
<meta property="schema:position" content="1" />
</li>
<li property="schema:itemListElement" typeof="schema:ListItem">
<a property="schema:item" typeof="schema:WebPage" href="https://example.com/article-a1">
<span property="schema:name">Article A1</span>
<span property="schema:about" typeof="schema:Thing">
<meta property="schema:name" content="Topic A" />
</span>
</a>
<meta property="schema:position" content="2" />
</li>
</ol>