尝试根据 Google 的 Structured Data Testing Tool 验证 schema.org/Article
时,我注意到如果您指定 SVG 图像,它会给出错误:
The value provided for logo must be a valid URL.
Required by:
AMP Articles (what's this?)
当 URL 更改为 .png
(或 .jpg
、.bmp
、.webp
时> 等)扩展名,而不是 .svg
,它通过了验证。
这是我正在使用的示例:
<div itemscope itemtype="http://schema.org/Article">
<div itemprop="publisher" itemscope itemtype="https://schema.org/Organization">
<meta itemprop="name" content="Example" />
<meta itemprop="url" content="http://example.com" />
<div itemprop="logo" itemscope itemtype="https://schema.org/ImageObject">
<meta itemprop="url" content="http://example.com/logo.svg" />
<meta itemprop="width" content="600" />
<meta itemprop="height" content="60" />
</div>
</div>
<meta itemprop="dateModified" content="2016-01-05T12:43" />
<meta itemprop="datePublished" content="2016-01-05T12:43" />
<meta itemprop="headline" content="Example" />
<meta itemprop="name" content="Example" />
<meta itemprop="author" content="Example" />
<link itemprop="mainEntityOfPage" href="http://example.com/article" />
<div itemprop="image" itemscope itemtype="https://schema.org/ImageObject">
<meta itemprop="url" content="http://example.com/article.jpg" />
<meta itemprop="width" content="1200" />
<meta itemprop="height" content="800" />
</div>
</div>
更改其他图像的 URL 扩展名也会产生错误。
我无法在 Rich Snippets documentation 中找到任何关于它为何拒绝 SVG 的信息。或AMP HTML spec 。有人对这种行为有解释吗?
最佳答案
Google 已更新 documentation并特别提到了 svg。
Logo 图像文件应该是光栅(例如,.jpg、.png、.gif),而不是矢量(例如,.svg),且不带动画。
关于AMP 文章微数据中的 SVG 图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35188719/