我确实看到了一些代码问题
1. url 属性放错位置
<div itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'>
<meta itemprop='url' content='/u/elvis'>
<a href='/u/elvis' itemprop='item'>
<span itemprop='image'>
<img width="45" height="45" class="avatar" src="https://sea1.discourse-cdn.com/flex001/user_avatar/forum.reflex.dev/elvis/45/31_2.png">
</span>
<span itemprop='name'>
elvis
- elvis
</span>
</a>
</div>
itemListElement 是一个 ListItem。
ListItem 有一个 item 属性,它是一个 Thing。
ListItem 不能有 url 属性
Thing 可以。请参阅 ListItem - Schema.org Type
因此, <meta itemprop='url' content='/u/elvis'> 行应该移到 item 属性值内的下面两行。
<div itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'>
<a href='/u/elvis' itemprop='item'>
<meta itemprop='url' content='/u/elvis'>
<span itemprop='image'>
<img width="45" height="45" class="avatar" src="https://sea1.discourse-cdn.com/flex001/user_avatar/forum.reflex.dev/elvis/45/31_2.png">
</span>
<span itemprop='name'>
elvis
- elvis
</span>
</a>
</div>
2. 缺少 position
这一个稍微主观一些。谷歌在这里 Carousel (ItemList) Structured Data | Google Search Central | Documentation | Google for Developers 说该属性是必需的
所以谷歌说“它是必需的”。
这意味着“谷歌需要它”,而不是“模式本身需要它”。
3. Schema.org 验证器损坏
我不知道它在做什么,但它没有正确验证。它应该已经捕获了 #1。
