Search code examples
csshtmlseosemantic-markupschema.org

Acceptable to apply visuallyhidden class to schema properties?


When adding schema data to your site for SEO, it seems like a no-brainer to keep all your schema data within one itemscope. Or at least on the same page with redundant itemscopes of the same type.

But let's say I'm following a style guide and only display certain properties on the site (e.g. not enough room in the footer to list all the item properties). Yet, I still want this information to show up in a search engine (e.g. hours of operation or a Google Map).

If I have a footer using the HealthAndBeautyBusiness schema data but only want to show some of the fields, is it okay to just list them and apply class="visuallyhidden" to the item properties I don't want to display?

<div class="contact_info" itemscope itemtype="http://schema.org/HealthAndBeautyBusiness">
    <span itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
        <p itemprop="streetAddress"></p>
        <p>
            <span itemprop="addressLocality"></span>,
            <span itemprop="addressRegion"></span> 
            <span itemprop="postalCode"></span>
        </p>
    </span>
    <p itemprop="email" class="visuallyhidden"></p>
    <p itemprop="telephone" class="visuallyhidden"></p>
</div>

In other words, is there a clearly defined way to distinguish between a malicious versus a proper use of the .visuallyhidden class?

Additional question: when a search engine crawls your site, does it crawl the entire site and store the aggregate schema data? Or does it treat schema data on each page as separate?


Solution

  • As far as Microdata and schema.org are concerned, this is valid.

    Note that Microdata allows the use of meta and link elements in the body, which are typically hidden by default, especially for the purpose of adding properties for content that is not visible on the page.

    Consumers (like search engines) might have additional rules about what they will ignore, what they will parse, what they will penalize, etc. However, discussing this is about SEO, which is off-topic here on Stack Overflow.