SwG requires configuring two main properties:
- The product ID that the user must be granted to view the content.
- Whether this content requires this product at this time.
SwG uses Schema.org markup. The JSON-LD and Microdata formats are supported.
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:
- The type must include
"CreativeWork"
or one of the following more specific types ofCreativeWork
:Article
NewsArticle
Blog
Comment
Course
HowTo
Message
Review
"isAccessibleForFree"
is a required field. Its value can be true or false.isAccessibleForFree": true
indicates that content is available for free.- The type in
isPartOf
must include "Product". - The product ID is [publication]:[label], for example
"productID": "norcal_tribune.com:basic"
.
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:
itemtype
must include"CreativeWork"
or one of the following more specific types ofCreativeWork
:Article
NewsArticle
Blog
Comment
Course
HowTo
Message
Review
"isAccessibleForFree"
can be true or false.isAccessibleForFree": true
indicates that content is available for free.- 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.