Overview
Use the Search Landing API with the Athena XAI Landing Page Builder to create dynamic landing pages from Athena XAI results.
The API returns the same data as the Search API, but formatted as HTML. All the rules that apply to the Search API also apply to the Search Landing API.
Create a search template
- Go to Dev Zone -> Search Templates on the Athena XAI Dashboard.
- Create or edit a search template. Templates are in Twig format. You can customize or create multiple templates, but only one can be active.
- Publish your template to make it ready for use.
Template variables
You can use these variables in a search template:
| Name | Type | Description |
|---|---|---|
products | array of objects | An array of products to show on the landing page. |
filters | array of objects | An array of liters to show on the landing page. |
active_filters | array of objects | An array of active filters. |
modes | array of objects | Page mode (grid or list). |
current_mode | string | Current page mode (grid or list). |
website_url | string | Your full website URL. |
q | string) | Search query. |
sorters | array of objects | An array of sorters to show on the landing page. |
initial_search | string | Initial sorter. |
clear_all_url | string | URL only with the query parameter. |
orders | array of objects | An array of orders (example: 16, 32, 64, 100). |
pages | array of objects | An array of pages. |
banners | array of objects | An array of banners to show on the landing page. |
totalResults | integer | Total number of products. |
from | integer | The number of the first product on the landing page. |
to | integer | The number of the last product on the landing page. |
min_price | double | The minimal price of filtered products. |
max_price | double | The maximal price of filtered products. |
min_price_all | double | The minimal price of initial products. |
max_price_all | double | The minimal price of initial products. |
How it works
Each Search Landing API call routes through the active search template and generates raw HTML for the page’s content and sidebar. Every API call returns this raw data. After a successful response, place the content on a blank landing page on your platform.
Request body
{
"q": "Yoga", //required
"token": "{{ website_token }}" //required
}
Successful response
{
"data": {
"content": "<div class=\"athena-main\"><div class=\"widget block block-static-block\"></div><div class=\"toolbar toolbar-products\">..."
"sidebar": "<div class=\"block filter\" id=\"layered-filter-block\" data-collapsible=\"true\">
<div class=\"block-title filter-title\" data-count=\"0\" role=\"tablist\">..."
}
}