Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

url vs sameAs (schema.org)

Tags:

url

schema.org

What's the practical difference between using url vs sameAs properties in schema.org?

I'm adding microdata information to the big Internet website, contains millions of pages. Using a correct tag is very important. The context may be, for example, the link to the official page on the page describing the County, State or a public Park. It may be also the link to external page with more details about the topic (which may be basically anything in a range from drugs prescriptions to an English grammar).

like image 965
Mike Keskinov Avatar asked Jan 08 '23 09:01

Mike Keskinov


1 Answers

[Note that you are linking to schema:URL (which is a datatype) and not to schema:url (which is the property your questions seems to be about). Schema.org URIs are case-sensitive.]

For authors: it often makes sense to think of url as the URL that you want to use (typically from your own website), and of sameAs as the URL(s) others use for the same thing (typically from external websites).

For consumers: it might make sense to use url for outputting a link, and for finding more data about the same item from the author’s perspective (e.g., following the link on a teaser page to the full article page), and to use sameAs for better understanding what the author is describing in their item.

Example

Let’s take Jamendo as example, a site about free/libre music.

They have a page about the music group "pornophonique" (/en/artist/8303/pornophonique) and they have various pages that link to this page (e.g., /en/search?qs=q=pornophonique).

The group also has an official website (http://www.pornophonique.de/) and a Wikipedia article (https://en.wikipedia.org/wiki/Pornophonique).

  • On the search result page, Jamendo could simply link to their own URL for that group:

    <!-- on <https://www.jamendo.com/en/search?qs=q=pornophonique> -->
    <article itemscope itemtype="http://schema.org/MusicGroup">
      <a itemprop="url" href="https://www.jamendo.com/en/artist/8303/pornophonique"></a>
    </article>
    
  • On the dedicated page, they could again specify this url, to make clear that it’s the canonical URL for the item:

    <!-- on <https://www.jamendo.com/en/artist/8303/pornophonique> -->
    <body itemscope itemtype="http://schema.org/MusicGroup">
      <link itemprop="url" href="https://www.jamendo.com/en/artist/8303/pornophonique" />
    </body>
    
  • And on this same page for the group, Jamendo could use sameAs to link to the official website (as the homepage URL typically represents the thing the site is about) and the Wikipedia article:

    <!-- on <https://www.jamendo.com/en/artist/8303/pornophonique> -->
    <body itemscope itemtype="http://schema.org/MusicGroup">
      <link itemprop="url" href="https://www.jamendo.com/en/artist/8303/pornophonique" />
    
      <section>
        <h1>External links</h1>
        <ul>
          <li><a itemprop="sameAs" href="http://www.pornophonique.de/">Official website</a></li>
          <li><a itemprop="sameAs" href="https://en.wikipedia.org/wiki/Pornophonique">Wikipedia article</a></li>
        </ul>
      </section>
    </body>
    

    (Of course they could do this also on the search result page, if they don’t mind the data repetition/overhead.)

  • And just to be sure: On Jamendo’s page about one of their tracks (e.g., https://www.jamendo.com/en/track/81740/sad-robot), Jamendo should not use url to link to the group’s page or sameAs to link to the Wikipedia article, as both URLs do not represent/identify the track. A possible sameAs value would be the URL of the page about this track on the group’s official website (http://www.pornophonique.de/download.php?song_id=1).

    <!-- on <https://www.jamendo.com/en/track/81740/sad-robot> -->
    <body itemscope itemtype="http://schema.org/MusicRecording">
      <link itemprop="url" href="https://www.jamendo.com/en/track/81740/sad-robot" />
      <link itemprop="sameAs" href="http://www.pornophonique.de/download.php?song_id=1" />
    </body>
    
like image 84
unor Avatar answered Jan 15 '23 15:01

unor