AMP 文章微数据中的 SVG 图像?

标签 svg schema.org microdata google-rich-snippets amp-html

尝试根据 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/

相关文章:

html - 使用 HTML5 和微数据标记博客文章的 "keywords"的正确方法?

html - 获取正确的架构以修复 "The itemprop attribute was specified, but the element is not a property of any item."

javascript - SVG 上的 .mouseover() 事件表现得很奇怪

WPF 在 WPF 中使用 SVG 文件作为图标的正确方法是什么

street-address - 如何使用 schema.org/PostalAddress 处理复杂地址?

google-webmaster-tools - Schema.org 和网站管理员工具丰富的片段工具

HTML5 微数据 - itemref 到另一个 itemscope(个人为组织工作)

javascript - 资源解释为文档但使用 MIME 类型传输 image/svg+xml :

svg - 在 Shopify 中使用 SVG 图标

html - 结构化数据 (schema.org) - 结构化数据测试工具中的多个 SiteNavigationElement