Boris Kozarac
Boris Kozarac

Reputation: 635

Schema markup for logo

I have this markup for Dentist 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>

When trying to test code for itemprop="logo" https://schema.org/logo Google testing gives me error: "A value for the url field is required." What am I missing?

I don't want logo to be visible on page, thats why I have put it as meta.

Upvotes: 1

Views: 3768

Answers (2)

NAVNEET CHANDAN
NAVNEET CHANDAN

Reputation: 289

Just in case if you are looking for a JSON-LD format, look over the below code and give it a shot.

"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"
    }
  },

Here is the full code if you wanna have a look, the schema micro-data was about a news article.

------------------full JSON-LD format below ----------------

    {
  "@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"
}

Upvotes: 2

unor
unor

Reputation: 96607

The error in Google’s SDTT is about the Dentist item, not about the ImageObject item. You can see this from the nesting level, the url row is on the same level as logo and address.

So adding a url property to the Dentist item would get rid of the error.

<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>

I changed the meta to link, because HTML5 and Microdata require that you use link (instead of meta) if the value is a URI.

Upvotes: 2

Related Questions