Configure JSON-LD
This article explains how to enable JSON-LD to present the correct metadata to search engine crawlers. You will also find a customisable JavaScript function that you can edit to suit your needs and configure the content structure. The article also includes examples of the JavaScript function and the recommendation to test it locally before implementing it on the platform.
In Experience Builder, you can enable JSON-LD in the views.json in any of your views by ticking the box (1) in each view and adding a reference (2) to a custom javascript function in which you pass the available content.
Based on customized javascript functions located in your custom.server.js, this will render the proper metadata that you want to present to Search Engine Crawlers. The javascript functions may be freely edited to meet your desired needs and configured content structure. A basic example is shown below.
We recommend testing your custom Javascripts locally first before setting them on the Experience.
Any code on custom.server.js must be created according to the fact that it will only be executed in the server environment. Thus, some functionality that you would have on the client is not available.