徽标的架构标记

时间:2016-07-07 13:36:44

标签: schema.org microdata

我有牙医https://schema.org/Dentist

的这个标记
<div itemscope itemtype="http://schema.org/Dentist">

    // address is ok
    <span itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
        <span itemprop="streetAddress">asdfd sf412</span>
        <span itemprop="postalCode">12345</span>
        <span itemprop="addressLocality">sadfsdf</span>
    </span>

    // this fails
    <span itemprop="logo" itemscope itemtype="http://schema.org/ImageObject">
        <meta itemprop="url" content="logo.gif'; ?>"  />
    </span>

</div>

尝试测试itemprop="logo" https://schema.org/logo的代码时 Google测试给出了错误:&#34;网址字段的值是必需的。&#34; 我错过了什么?

我不希望徽标在页面上显示,这就是为什么我把它作为元素。

2 个答案:

答案 0 :(得分:2)

Google的SDTT中的错误与Dentist项有关,而与ImageObject项无关。您可以从嵌套级别看到这一点,url行与logoaddress处于同一级别。

因此,向url项添加Dentist属性可以消除错误。

<div itemscope itemtype="http://schema.org/Dentist">

  <span itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
    <span itemprop="streetAddress">asdfd sf412</span>
    <span itemprop="postalCode">12345</span>
    <span itemprop="addressLocality">sadfsdf</span>
  </span>

  <span itemprop="logo" itemscope itemtype="http://schema.org/ImageObject">
    <link itemprop="url" href="logo.gif" />
  </span>

  <link itemprop="url" href="http://example.com/" />

</div>

我将meta更改为link,因为如果值为URI,则HTML5和微数据要求您使用link(而不是meta)。

答案 1 :(得分:1)

以防万一,如果您正在寻找 JSON-LD 格式,请查看下面的代码并试一下。

"publisher": {
    "@type": "Organization",
    "name": "Lokaci",
    "url": "https://lokaci.com",
    "logo": {
      "@type": "ImageObject",
      "url": "https://res.cloudinary.com/lokaci/image/upload/v1580448186/logo/lokaci_logo_black-corp-comp_nzkooj.png"
    }
  },

如果您想看看,这是完整的代码,模式微数据是关于一篇新闻文章。

----------------------------------下方的完整JSON-LD格式

    {
  "@context": "https://schema.org",
  "@type": "NewsArticle",
  "url": "https://lokaci.com/news/Diwali-Countdown-Offer-A-Brothers-Gift",
  "publisher": {
    "@type": "Organization",
    "name": "Lokaci",
    "url": "https://lokaci.com",
    "logo": {
      "@type": "ImageObject",
      "url": "https://res.cloudinary.com/lokaci/image/upload/v1580448186/logo/lokaci_logo_black-corp-comp_nzkooj.png"
    }
  },
  "dateline": "Laxminagar Delhi, 26 October 2019",
  "headline": "Diwali Countdown Offer: A Brother’s Gift",
  "mainEntityOfPage": "https://lokaci.com/newsroom",
  "author": {
    "@type": "Organization",
    "name": "Lokaci",
    "logo": "https://res.cloudinary.com/lokaci/image/upload/v1580448186/logo/lokaci_logo_black-corp-comp_nzkooj.png"
  },
  "image": "https://res.cloudinary.com/lokaci/image/upload/v1575284148/Newsroom/A-One-Salon-Lokaci-wins-Oppo-phone_dfvzdl.jpg",
  "datePublished": " 26 October 2019",
  "dateModified": " 26 October 2019",
  "wordCount": 165,
  "keywords": "Lokaci, News"
}