【发布时间】:2016-03-18 17:08:56
【问题描述】:
我正在尝试为文章启用 Google 的 Rich Snippets,但它一直要求为文章提供图片。我实际上并不想在页面上显示图像,那么如何标记它以便它为 Google 提供图像的 URL?使用类似 -
<div class='container' id="content-text" typeof="Article">
<span typeof="imageObject">
<span property="image"><span property="contentUrl" content="/static/imgs/protraits/{{content.author|san_str}}.jpg"></span></span>
</span>
<h1><span property="name">{{ content.title }}</span></h1>
<h2>{% if content.subtitle %}{{ content.subtitle }}{% endif %}
<small>by <span property="author">{{ content.author }}</span></small></h2>
<div property="articleBody">{{ content.text|safe }}</div>
</div>
我能够让测试人员识别图像对象,但它与文章对象是分开的。如果我尝试使图像成为文章的属性,它会告诉我contentUrl 不是Article 的有效属性。
【问题讨论】:
-
请注意,URI 是区分大小写的,所以它必须是
ImageObject而不是imageObject。
标签: html schema.org google-rich-snippets rdfa