Resource Look Ups
Overview
To add details from specific resources to your content instead of relying on recommendations, you can use the resource look-up merge tags. Resources can be retrieved with either a single resource lookup or by querying for multiple resources.
Specific Resource Lookup
Individual resources can be retrieved with any property a resource has. The most common and consistent way to retrieve a specific resource is by using the resource ID. In the following example, the resource ID is the same as the product SKU.
{% resource product | id: sku %}
This tag creates the object {{product}}
and assigns the contents of the resource object to it.
If you want to populate the title of the resource in the content, use {{product.title}}
.
Multiple Resource Query
Retrieving multiple resources without the personalization help of our Recommendations engine is done with a resources query.
Here is an example of a 'resources' tag:
{% resources products
| count: 3
| filter: 'resource-type', '=', 'article|product'
| filter: 'pubDate', 'AFTER', '-P1D'
| filter: 'category', 'CONTAINS', 'baseball'
| sort_field: 'start_date'
| sort_order: 'asc'
%}
Resources Query Parameters:
Parameters | Description |
---|---|
count | Specify the number of resources to be returned in your query. |
filter | The one or more resource fields to query against. |
sort_field | The numerical, timestamp, or string type fields to sort the returned array on. |
sort_order | The order in which the array of resources will be returned. |