JSON-LD Filter on metadata

JSON-LD Filter on metadata

data.ldjsonfilter.category="Hiking"

Or if prediction is made via Javascript:

options.overwrite['ldjsonfilter.greenEstate'] = 'true';

Look at the example below to see how you filter out these pages when doing recommendations.

Complete example where keywords are filtered on:

In order for a page to be filtered, you can add this to an ld+json object.

<script type="application/ld+json" data-rekai>
  {
    "@context": "https://schema.org",
    "@type": "Article",
    "keywords": "summer"
  }
</script>

It is then possible to filter on this value either in the html div:

<div class="rek-prediction" data-ldjsonfilter.keywords="summer"></div>

Or via javascript:

<script>
  $( document ).ready(function() {
    function printPredictions(data) {
      console.log(data);
    }
 
    var options = {
      overwrite: {
        subtree: '/news/',
      }
    };
    // Filter on this keyword
    options.overwrite['ldjsonfilter.keywords'] = 'summer';
 
    window.__rekai.predict(options, generatePredictions);
  });
</script>

Comma separate the filter

If you enter several choices separated by a comma, it is enough for one of them to be correct for the page to be sent back as a recommendation.

<div class="rek-prediction" data-ldjsonfilter.keywords="summer,winter"></div>

Use category to filter products or pages

If a website has a large number of products that are divided into several categories, these can be filtered using "category". Rek.ai reads "category" from your json ld object, and then lets you filter on the value using data-category. Categories are divided into subgroups in the same way that Google does in its functions. Namely by adding ">" to the string.

Example: "Food>Breakfast>Eggs"

You can then filter on which of these levels you want to get all products within the category.

Example: data-filtercategory="Food>Breakfast"