Server side rendering
Why Questions and Answers Should Be Rendered Server-Side
Rendering Q&A content server-side ensures it's included directly in the HTML, making it fully visible to search engines and AI tools. This improves SEO/AEO, increases the chances of appearing in rich results, and ensures your content is accessible to AI-driven platforms from the start.
To make the questions and answers visible to search engines and AI tools, your server simply needs to make a GET request to our API. The response is a raw JSON object containing the questions and answers OR the complete HTML-structure with matching LD+JSON.
A quick start for fetching the questions and answers server-side.
Parameters to be used for Questions and Answers server-side rendering
Since we want to display only the questions related to the current page each time the Questions and Answers are rendered server-side, we need to include the page URL and specify that the questions should always appear in the same order.
- projectid=YOUR_PROJECT_ID (read more)
- secret=YOUR_SECRET (read more)
- entitytype=rekai-qna (read more)
- subtree=^/path/to/page/$ (read more)
- unranked=true (read more)
- format=html (read more)
So a complete GET request would look like this:
GET https://api.rekai.se/v1/predictions?projectid=YOUR_PROJECT_ID&secret=YOUR_SECRET&entitytype=rekai-qna&subtree=^/path/to/page/$&unranked=true&format=htmlRendering as HTML with LD+JSON schema
By default, rek.ai returns recommendations as JSON, which are then formatted in the front end.
However, for the Questions and Answers server-side rendering, we want to render both HTML and an LD+JSON block (opens in a new tab).
To achieve this, we set the format parameter to html.
Server side caching
Of course, it is important that Questions are rendered as quickly as possible on the page. So if you are fetching them server-side, we recommend that you have a local cache of the response for each page. Although we have our own caching systems, it is of course fastest not to make a request to us on every page view.
If you are using Sitevision you can use their built-in caching system (opens in a new tab) for this.