RDFa OfferCatalog Syntax

后端 未结 2 1303
说谎
说谎 2021-01-26 18:56

I have been trying to find the best way to link two items together using RDFa, specifically linking a Person to multiple SoftwareApplication entries.

The way I currently

相关标签:
2条回答
  • 2021-01-26 19:39

    Thank you for the other response, I'll have a read over the linked resources, I have also found a solution to the specific case in my question.

    Google Search Console has a page on Carousels which shows that you can use ListItem, which only "needs" URL, to populate the hasOfferCatalog property. E.g.

    <span property="itemListElement" typeof="ListItem">
      <meta property="position" content="1" />
      <meta property="url" content="https://www.my-domain.tld/ProjectName/" />
    </span>
    
    0 讨论(0)
  • 2021-01-26 19:42

    To link items together, you need a suitable property. Like author (to state which Person is the creator of the SoftwareApplication), or like hasOfferCatalog (to state which SoftwareApplication is offered by the Person).

    Inverse properties

    In most cases, Schema.org defines its properties only for one direction. So there is only author, and no authorOf. If you need the property for the other direction, you can use RDFa’s rev attribute.

    Linking instead of repeating

    If you don’t want to repeat your data (i.e., only define it once and link/refer to this definition instead), you can provide a URL value. Schema.org allows this for all properties, even if URL is not listed as expected type. If you want to follow Semantic Web best practices, give your entities URLs (as identifiers) with RDFa’s resource attribute, and use these URLs as property values to refer to the entities.

    For this, simply use one of the linking elements (e.g., elements with href or src attribute).

    Example

    Using the author case as example:

    <!-- on the page about the software: /software/5 -->
    
    <div typeof="schema:SoftwareApplication" resource="/software/5#this">
      Author: 
      <a property="schema:author" typeof="schema:Person" href="/persons/alice#i">Alice</a>
    </div>
    
    <!-- on the page about the person: /persons/alice -->
    
    <div typeof="schema:Person" resource="/persons/alice#i">
      Authored by:
      <a rev="schema:author" typeof="schema:SoftwareApplication" href="/software/5#this">Software 5</a>
    </div>
    

    Errors in Google’s SDTT

    If the Structured Data Testing Tool gives errors about missing properties, note that it doesn’t mean that something is wrong with your markup. Schema.org never requires a property.

    It just means that these properties are required for getting a certain Google search feature. So ignore these errors if you don’t want to get the feature (or if you can’t provide all required properties).

    0 讨论(0)
提交回复
热议问题