在Article sheme上设置徽标属性

时间:2016-07-03 00:41:59

标签: html schema.org microdata

我在设置logo方案的Article属性方面遇到了一些问题。

通常情况下,Article必须为publisherpublisher必须为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>

当我测试前面的代码时,它可以工作,没有错误是givven。但当我把它放在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>
...

项目类型错误消失,并显示徽标错误:徽标:需要徽标字段的值。

如何正确设置logo方案的Article属性?

*使用Google's strucured data testing tool

测试微数据

1 个答案:

答案 0 :(得分:0)

以下结构通过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>