Schema.org Organization: url, logo in one place and social links in another

So, I just stumbled upon "sameAs" for a type of schema.org that allows you to link your social profiles. My problem is that my url and logo are in one place (header) and social links are in another (footer).

<div class="container custom-top" itemscope itemtype="http://schema.org/Organization"> <a class="custom-logo" itemprop="url" href="/"> <img itemprop="logo" alt="sitename" height="40" src="/assets/img/logo-main.png" width="161"> </a> </div> 

My social links are in a completely different place:

 <ul class="list-inline"> <li> <a href="https://www.facebook.com/site" data-window="external" data-placement="top" rel="tooltip" title="Facebook"></a> <a href="https://twitter.com/site" data-window="external" data-placement="top" rel="tooltip" title="Twitter"></a> <a href="https://plus.google.com/site" data-window="external" data-placement="top" rel="tooltip publisher" title="Google+"></a> </li> </ul> 

In an ideal world, this would be something like this, where everything is a child of the itemtype, but because of my design, this is simply not possible.

 <span itemscope itemtype="http://schema.org/Organization"> <a itemprop="url" href="/"> <img itemprop="logo" src="/assets/img/logo-main.png" </a> <a itemprop="sameAs" href="http://www.facebook.com/your-company">FB</a> <a itemprop="sameAs" href="http://www.twitter.com/YourCompany">Twitter</a> </span> 

So, is there anyway to get around this outside the premises of just one and the same place? I read about itemref and linking items together, but can't get it working when testing with the Google Structured Data Testing Tool.

Please do not tell me to leave the div open and substantially cover the entire page with the type of organization. I hope there will be a clean path around this. Schema.org cannot expect everything to be well grouped on every web page.

+1
source share
3 answers

The Microdatas itemref may be a solution. But this only works if you do not have another parent itemtype open (for example, on the body ).

 <div itemscope itemtype="http://schema.org/Organization" itemref="social-links"> <a itemprop="url" href="/"> <img itemprop="logo" alt="sitename" src="logo.png"> </a> </div> <ul id="social-links"> <li><a itemprop="sameAs" href="https://www.facebook.com/site"></a></li> <li><a itemprop="sameAs" href="https://twitter.com/site"></a></li> <li><a itemprop="sameAs" href="https://plus.google.com/site"></a></li> </ul> 

Schema.org cannot expect everything to be well grouped on every web page.

Note that the Schema.org dictionary is not just for Microdata syntax. Other syntaxes do not necessarily have this problem: JSON-LD does not depend on markup, RDFa can get around this with a URI (for example, through the resource attribute) and, possibly, also with a mechanism for copying properties. (Microdatas itemid can, in principle, solve this problem too, but I believe that it is not defined for this and has poor customer support.)

+4
source

If you don't need to use the Schema.org markup on your site, JSON-LD is another option.

In the Google documentation for the sameAs social profile sameAs , they include this JSON-LD code template as an example:

 <script type="application/ld+json"> { "@context" : "http://schema.org", "@type" : "Organization", "name" : "Your Organization Name", "url" : "http://www.your-site.com", "sameAs" : [ "http://www.facebook.com/your-profile", "http://www.twitter.com/yourProfile", "http://plus.google.com/your_profile"] } </script> 

Now we use this method, which includes information about our organization on our website, because we had the same problem as you. This JSON-LD structured data is valid, according to the Google Structured Data Testing Tool .

+4
source
 <div itemscope itemtype="http://schema.org/Organization"> <link itemprop="url" href="/"> <img itemprop="logo" alt="sitename" src="logo.png"> <ul> <li><a itemprop="sameAs" href="https://www.facebook.com/site"></a></li> <li><a itemprop="sameAs" href="https://twitter.com/site"></a></li> <li><a itemprop="sameAs" href="https://plus.google.com/site"></a></li> </ul> </div> 

Try this, I do not see any error on it.

-1
source

Source: https://habr.com/ru/post/986013/


All Articles