Всі знають про мікродані, але ніхто не знає, як і коли правильно їх використовувати. Після пошуку різних запитань StackOverflow та результатів Google я придумав таку структуру.
<nav itemscope itemtype="http://schema.org/SiteNavigationElement">
<ul itemscope itemtype="http://schema.org/ItemList">
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<meta itemprop="position" content="1">
<a href="http://example.com/page1" itemprop="url">
<span itemprop="name">Page 1</span>
</a>
</li>
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<meta itemprop="position" content="2">
<a href="http://example.com/page2" itemprop="url">
<span itemprop="name">Page 2</span>
</a>
<ul itemscope itemtype="http://schema.org/ItemList">
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<meta itemprop="position" content="1">
<a href="http://example.com/page2-1" itemprop="url">
<span itemprop="name">Page 2-1</span>
</a>
</li>
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<meta itemprop="position" content="2">
<a href="http://example.com/page2-2" itemprop="url">
<span itemprop="name">Page 2-2</span>
</a>
</li>
</ul>
</li>
</ul>
</nav>
Єдина проблема, яка в мене полягає в тому, що я отримую "декілька націнок на ListList на сторінці заборонені" помилка від Google Testing Tool: https://search.google.com/structured-data/testing-tool
Кожен інший валідатор schema.org добре з цим. Чи є помилка в моєму коді чи в Інструменті Google?
Оновлення: здається, що Google просто не подобається, що на сторінці є декілька списків елементів. Це однозначно проти стандартів schema.org. Якщо помістити цей код два рази, я отримаю ту саму помилку.
<ul itemscope itemtype="http://schema.org/ItemList">
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<meta itemprop="position" content="1">
<a title="Page 1" href="http://example.com/page1" itemprop="url">
<span itemprop="name">Page 1</span>
</a>
</li>
</ul>
Відповіді:
0 для відповіді № 1The Інструмент тестування структурних даних Google не є загальною шашкою Schema.org. Більшість попереджень / помилок стосуються багатих результатів у пошуку Google.
Наприклад, Каруселі багатий результат використовує ItemList
, тому помилка може означати, що Ваша сторінка не може отримати такий багатий результат у результатах пошуку Google. Якщо ви не хочете (або не можете) отримати такий багатий результат, ви можете ігнорувати помилку.
Schema.org не обмежує, як часто тип може використовуватися в документі.