Schema.org markup question

Hi there,

I am wanting to mark up some addresses on my website.

This is what I have so far:

     <div itemscope itemtype="http://schema.org/PostalAddress">
     <span itemprop="name">Business name</span>
     <span itemprop="addressLocality">building name, Road name</span>,
     <span itemprop="addressRegion">town, county</span>
     <span itemprop="postalCode">postcode</span>
    </div>
    <span itemprop="telephone"><a href="tel:123">123</a></span>

As you can see, I have some locations in the same tag - is this ok, or should each have its own itemprop?

Thanks

Take a look at the schema for PostalAddress here:-

It lists all the available properties.

I would have that as StreetAddress

Locality.

Region.

Also, depending on context, should the address be an itemprop of some parent entity?

<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">

Thanks. But is it ok to have two things in one line, e.g building name, Road name?

How do you mean should it be of a parent entity?

That seems right for street address.

streetAddress | Text | The street address. For example, 1600 Amphitheatre Pkwy.

Presumably the address belongs to something, like a business or place which is the subject of the page or that section of the page. Just an address on its own, not belonging to anything would seem kind of meaningless.

Thanks.

I have the following:

<div itemscope itemtype="http://schema.org/LocalBusiness">
     <span itemprop="name">Business name</span>
.... then the address

Also, I have some telephone listings which I have marked up as follows:

<h4>Citizens Advice Bureau</h4>
     <div itemscope itemtype="http://schema.org/LocalBusiness">
     <span itemprop="telephone"><i class="fa fa-phone" aria-hidden="true"></i> <a href="tel:123">123</a></span>
    </div>

Should I place the H4 inside a <span itemprop="name"> tag?

So yes, the address is a property of the business and should be marked up as such.

No! Headings are block elements, spans are inline. Placing an h# in a span would be invalid, using a div (block element) would be fine.
But, do you really need the extra tag?
You can add the schema attributes directly into any html element. You only need a the generic div and span elements when the is no element available in the structure to hold the attributes.
So…

<h4 itemprop="name">Citizens Advice Bureau</h4>

…would be the most efficient mark up in this case.

However, I just notice your nesting is wrong. The heading is outside of the div which defines the item scope of the business. Properties must be declared within the item scope.

1 Like

I see, thanks, that makes sense :slight_smile: Thanks for your help!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.