在 Article sheme 上设置徽标 属性
Set logo property on Article sheme
我在设置 Article
方案的 logo
属性 时遇到一些问题。
通常,Article
必须有一个 publisher
,而 publisher
必须是一个 Organization
。
我用于 Organization is the following
的代码
<div itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="PublisherName">
<a itemprop="url" href="/">
<img itemprop="logo" src="http://www.example.com/logo.png">
</a>
</div>
当我测试之前的代码时,它运行正常并且没有报错。但是当我把它放在 Article
中时,我得到了一些错误。
这是完整代码的示例:
<div itemscope itemtype="http://schema.org/Article">
<h1 itemprop="headline">Article</h1>
<div itemprop="image" itemscope itemtype="http://schema.org/ImageObject">
<img itemprop="url" src="http://www.example.com/logo.png" alt="Debian Packages">
<meta itemprop="width" content="220" >
<meta itemprop="height" content="220" >
</div>
<meta itemprop="datePublished" content="2014-08-10">
<meta itemprop="dateModified" content="2016-06-02">
<a itemprop="mainEntityOfPage" href="/ArticleLink"></a>
<div itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="ArticleAuthor">
</div>
<div itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="PublisherName">
<a itemprop="url" href="/">
<img itemprop="logo" src="http://www.example.com/logo.png">
</a>
</div>
</div>
前面的代码生成错误:logo: http://www.example.com/logo.png(属性 itemtype 的值无效。)
这有点奇怪,因为如果我删除 logo
属性:
...
<div itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="PublisherName">
<a itemprop="url" href="/"></a>
</div>
...
项目类型错误消失,出现徽标错误:徽标:需要徽标字段的值。
如何为 Article
方案正确设置 logo
属性?
测试
以下结构通过了 Google 测试。
<div itemscope itemtype="http://schema.org/Article">
<h1 itemprop="headline">Article</h1>
<div itemprop="image" itemscope itemtype="http://schema.org/ImageObject">
<img itemprop="url" src="http://www.example.com/logo.png" alt="Debian Packages">
<meta itemprop="width" content="220" >
<meta itemprop="height" content="220" >
</div>
<meta itemprop="datePublished" content="2014-08-10">
<meta itemprop="dateModified" content="2016-06-02">
<a itemprop="mainEntityOfPage" href="/ArticleLink"></a>
<div itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="ArticleAuthor">
</div>
<div itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="PublisherName">
<a itemprop="url" href="/">
<span itemprop="logo" itemscope itemtype="http://schema.org/ImageObject" >
<img itemprop="image" src="http://www.example.com/logo.png" />
<link itemprop="url" href="http://www.example.com/logo.png" />
</span>
</a>
</div>
</div>
更新
大概,下面就更好了
<div itemscope itemtype="http://schema.org/Article">
<h1 itemprop="headline">Article</h1>
<div itemprop="image" itemscope itemtype="http://schema.org/ImageObject">
<img itemprop="url" src="http://www.example.com/logo.png" alt="Debian Packages">
<meta itemprop="width" content="220" >
<meta itemprop="height" content="220" >
</div>
<meta itemprop="datePublished" content="2014-08-10">
<meta itemprop="dateModified" content="2016-06-02">
<a itemprop="mainEntityOfPage" href="/ArticleLink"></a>
<div itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="ArticleAuthor">
</div>
<div itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="PublisherName">
<a itemprop="logo" itemscope itemtype="http://schema.org/ImageObject" href="/">
<img itemprop="image" src="http://www.example.com/logo.png" />
<link itemprop="url" href="http://www.example.com/logo.png" />
</a>
</div>
</div>
我在设置 Article
方案的 logo
属性 时遇到一些问题。
通常,Article
必须有一个 publisher
,而 publisher
必须是一个 Organization
。
我用于 Organization is the following
<div itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="PublisherName">
<a itemprop="url" href="/">
<img itemprop="logo" src="http://www.example.com/logo.png">
</a>
</div>
当我测试之前的代码时,它运行正常并且没有报错。但是当我把它放在 Article
中时,我得到了一些错误。
这是完整代码的示例:
<div itemscope itemtype="http://schema.org/Article">
<h1 itemprop="headline">Article</h1>
<div itemprop="image" itemscope itemtype="http://schema.org/ImageObject">
<img itemprop="url" src="http://www.example.com/logo.png" alt="Debian Packages">
<meta itemprop="width" content="220" >
<meta itemprop="height" content="220" >
</div>
<meta itemprop="datePublished" content="2014-08-10">
<meta itemprop="dateModified" content="2016-06-02">
<a itemprop="mainEntityOfPage" href="/ArticleLink"></a>
<div itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="ArticleAuthor">
</div>
<div itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="PublisherName">
<a itemprop="url" href="/">
<img itemprop="logo" src="http://www.example.com/logo.png">
</a>
</div>
</div>
前面的代码生成错误:logo: http://www.example.com/logo.png(属性 itemtype 的值无效。)
这有点奇怪,因为如果我删除 logo
属性:
...
<div itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="PublisherName">
<a itemprop="url" href="/"></a>
</div>
...
项目类型错误消失,出现徽标错误:徽标:需要徽标字段的值。
如何为 Article
方案正确设置 logo
属性?
以下结构通过了 Google 测试。
<div itemscope itemtype="http://schema.org/Article">
<h1 itemprop="headline">Article</h1>
<div itemprop="image" itemscope itemtype="http://schema.org/ImageObject">
<img itemprop="url" src="http://www.example.com/logo.png" alt="Debian Packages">
<meta itemprop="width" content="220" >
<meta itemprop="height" content="220" >
</div>
<meta itemprop="datePublished" content="2014-08-10">
<meta itemprop="dateModified" content="2016-06-02">
<a itemprop="mainEntityOfPage" href="/ArticleLink"></a>
<div itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="ArticleAuthor">
</div>
<div itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="PublisherName">
<a itemprop="url" href="/">
<span itemprop="logo" itemscope itemtype="http://schema.org/ImageObject" >
<img itemprop="image" src="http://www.example.com/logo.png" />
<link itemprop="url" href="http://www.example.com/logo.png" />
</span>
</a>
</div>
</div>
更新
大概,下面就更好了
<div itemscope itemtype="http://schema.org/Article">
<h1 itemprop="headline">Article</h1>
<div itemprop="image" itemscope itemtype="http://schema.org/ImageObject">
<img itemprop="url" src="http://www.example.com/logo.png" alt="Debian Packages">
<meta itemprop="width" content="220" >
<meta itemprop="height" content="220" >
</div>
<meta itemprop="datePublished" content="2014-08-10">
<meta itemprop="dateModified" content="2016-06-02">
<a itemprop="mainEntityOfPage" href="/ArticleLink"></a>
<div itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="ArticleAuthor">
</div>
<div itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="PublisherName">
<a itemprop="logo" itemscope itemtype="http://schema.org/ImageObject" href="/">
<img itemprop="image" src="http://www.example.com/logo.png" />
<link itemprop="url" href="http://www.example.com/logo.png" />
</a>
</div>
</div>