JSON-LD Add to page
For rek.ai to know the JSON-LD shall be collected it is best to add data-rekai
to the script-tag.
By integrating your metadata into the JSON-LD, we gain the capability to utilize and apply filters to it. It is not necessary to include every property; only those you wish to incorporate need to be added.
When troubleshooting, it can be useful to validate your JSON formatter (opens in a new tab).
Example of a page with properties:
<script type="application/ld+json" data-rekai>
{
"@context": "https://schema.org",
"@type": "NewsArticle",
"genre": "search engine optimization",
"keywords": "seo sales b2b",
"additionalType": "Guide"
}
</script>
An example of an apartment:
<script type="application/ld+json" data-rekai>
{
"@context":"http://schema.org",
"@type":"Product",
"name": "Test route 1 A",
"description": "Number of rooms: 3 Living area: 79.7 m²",
"offers": {
"@type": "Offer",
"price": "100000",
"priceCurrency": "SEK"
},
"location": "Gronkoping",
"image": "https://www.test.se/bilder/hus.jpg"
}
</script>
Example of using keywords in Sitevision
#set ($utils = $request.getAttribute('sitevision.utils'))
#set ($propertyUtil = $utils.propertyUtil)
#set ($currentPage = $utils.portletContextUtil.currentPage)
#set ($keywords = $propertyUtil.getString($currentPage, 'keywords', ''))
#if($keywords != '')
<script type="application/ld+json" data-rekai>
{
"@context": "https://schema.org",
"@type": "Article",
"keywords": "$keywords" // Can be a string comma separated
}
</script>
#end