Skip to content

Latest commit

 

History

History
94 lines (78 loc) · 3.11 KB

page-markup.md

File metadata and controls

94 lines (78 loc) · 3.11 KB

Subscriptions Page Markup

SwG requires configuring two main properties:

  1. The product ID that the user must be granted to view the content.
  2. Whether this content requires this product at this time.

SwG uses Schema.org markup. The JSON-LD and Microdata formats are supported.

JSON-LD markup

Using JSON-LD, the markup would look like:

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "NewsArticle",
  "isAccessibleForFree": false,
  "publisher": {
    "@type": "Organization",
    "name": "The Norcal Tribune"
  },
  "hasPart": {...},
  "isPartOf": {
    "@type": ["CreativeWork", "Product"],
    "name" : "The Norcal Tribune",
    "productID": "norcal_tribune.com:basic"
  }
}
</script>

Thus, notice that:

  1. The type must include "CreativeWork" or one of the following more specific types of CreativeWork:
    • Article
    • NewsArticle
    • Blog
    • Comment
    • Course
    • HowTo
    • Message
    • Review
  2. "isAccessibleForFree" is a required field. Its value can be true or false. isAccessibleForFree": true indicates that content is available for free.
  3. The type in isPartOf must include "Product".
  4. The product ID is [publication]:[label], for example "productID": "norcal_tribune.com:basic".

Microdata markup

Using Microdata, the markup could look like this:

<div itemscope itemtype="http://schema.org/NewsArticle">
  <meta itemprop="isAccessibleForFree" content="false"/>
  <div itemprop="isPartOf" itemscope itemtype="http://schema.org/CreativeWork http://schema.org/Product">
    <meta itemprop="name" content="The Norcal Tribune"/>
    <meta itemprop="productID" content="norcal_tribune.com:basic"/>
  </div>
</div>

A usable configuration will provide NewsArticle typed item with isAccessibleForFree property and a subitem of type Product that specifies the productID.

In this example:

  1. itemtype must include "CreativeWork" or one of the following more specific types of CreativeWork:
    • Article
    • NewsArticle
    • Blog
    • Comment
    • Course
    • HowTo
    • Message
    • Review
  2. "isAccessibleForFree" can be true or false. isAccessibleForFree": true indicates that content is available for free.
  3. The product ID is [publication]:[label], for example "productID": "norcal_tribune.com:basic".

The configuration is resolved as soon as productID and isAccessibleForFree are found. It is, therefore, advised to place the configuration as high up in the DOM tree as possible.