【问题标题】:Schema.org - Referencing single definition multiple timesSchema.org - 多次引用单个定义
【发布时间】:2016-02-08 08:55:24
【问题描述】:

我有一个包含多篇文章的页面,我希望每篇文章都将发布者描述为一个组织,但我想避免为每篇文章重新定义该组织。这可能吗?

itemref 属性似乎只在相反的方向工作,指定父 > 子关系,而不是相反。

在此示例中,我从 Schema.org 中获取了组织示例,希望能说明问题 - 您不能每次都重复此标记,它会使页面膨胀。

<div itemscope itemtype="http://schema.org/Organization">
  <span itemprop="name">Google.org (GOOG)</span>
  Contact Details:
    <div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
      Main address:
        <span itemprop="streetAddress">38 avenue de l'Opera</span>
        <span itemprop="postalCode">F-75002</span>
        <span itemprop="addressLocality">Paris, France</span>
      ,
    </div>
      Tel:<span itemprop="telephone">( 33 1) 42 68 53 00 </span>,
      Fax:<span itemprop="faxNumber">( 33 1) 42 68 53 01 </span>,
      E-mail: <span itemprop="email">secretariat(at)google.org</span>
  Members:
  - National Scientific Members in 100 countries and territories: Country1, Country2, ...
  - Scientific Union Members, 30 organizations listed in this Yearbook:
  List of Alumni:
  <span itemprop="alumni" itemscope itemtype="http://schema.org/Person">
    <span itemprop="name">Jack Dan</span>
  </span>,
  <span itemprop="alumni" itemscope itemtype="http://schema.org/Person">
    <span itemprop="name">John Smith</span>
  </span>
</div>

<div itemscope itemtype="http://schema.org/NewsArticle">
  <meta itemprop="url" content="{{canonical_url}}" />
  <link itemprop="mainEntityOfPage" href="{{canonical_url}}">
  <meta itemprop="genre" content="{{genre}}" />
  <meta itemprop="publisher" temtype="http://schema.org/Organization" content="{{???}}" />
  <meta itemprop="dateModified" content="{{updated_at}}" />
  <div class="item-content">
    <div class="item-header" itemprop="name headline">
      {{Headline}}
    </div>
    <div class="item-body">

      <p itemprop="articleBody">
        {{content goes here}}
      </p>

    </div>

    <div class="item-footer">
      <span itemprop="datePublished dateCreated">{{date}}</span> - <span itemprop="creator author copyrightHolder">{{byline}}</span>
    </div>
  </div>
</div>

我目前正在使用微数据,但如果我正在尝试使用 JSON,那么我会考虑切换。

【问题讨论】:

    标签: schema.org microdata json-ld


    【解决方案1】:

    如果您在同一页面上有一个 Organization 项目和多个 Article 项目,则可以使用 Microdata 的 itemref 属性提供 Organization 项目作为 publisher 属性的值:

    <div itemprop="publisher" itemscope itemtype="http://schema.org/Organization" id="publisher-1">
    </div>
    
    <article itemscope itemtype="http://schema.org/Article" itemref="publisher-1">
    </article>
    
    <article itemscope itemtype="http://schema.org/Article" itemref="publisher-1">
    </article>
    
    <article itemscope itemtype="http://schema.org/Article" itemref="publisher-1">
    </article>
    

    如果使用它,您必须确保div(对于Organization 项)不是具有itemscope 的另一个元素的子元素(否则它将作为publisher 添加到该项中另外)。

    【讨论】:

    • 谢谢,我试试看
    猜你喜欢
    • 2015-02-16
    • 1970-01-01
    • 2016-11-30
    • 1970-01-01
    • 2017-11-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多