JSON-LD Add to page

JSON-LD Add to page

For Rek.ai to know that a JSON-LD block should be collected, add data-rekai to the script tag. Once your metadata is included in the JSON-LD, we can use it and apply filters to it. You don't need to include every property, only the ones you want to use.

When troubleshooting, it can help to validate your JSON-LD using a 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>

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"
    }
  </script>
#end