Forum Discussion
DavidO
12 months agoStrategist II
Is it possible to store liquid and content blocks inside catalogs?
Hi all Recently we tried putting a section of liquid + text inside a catalog item but it only rendered as text. I then put it inside a content block and it seemed to render for the first item but ...
Stuart
Practitioner III
Hey DavidO,
'Is it possible to store liquid and content blocks inside catalogs? ' Not in the way you have described.
If you wish to use a Catalog (so you can update 'items' (cells) with a CSV or via Catalog API or CDI) to control the content that is displayed to a user, I would recommend the following approach:
- Create a Catalog (e.g. 'Catalog-SSOT') and add a 'field' (column) name for each of the content areas of your email (e.g. header_img, header_cta etc).
- Create a Content Block for each corresponding content areas of the email (e.g. header_img-content_block, header_cta-content_block etc)
- Within these content blocks, store the different content versions and add liquid, eg:
{{content_blocks.${header_img-content_block}}} :
{% catalog_items Catalog-SSOT {{${user_id}}} %}
{% if items[0].header_img == "Version1 " %}
Version1header_img.png
{% elsif items[0].header_img == "Version2" %}
Version2header_img.png
{% elsif items[0].header_img == "Version3" %}
Version3header_img.png
{% endif %}
{{content_blocks.${header_cta-content_block}}} :
{% catalog_items Catalog-SSOT {{${user_id}}} %}
{% if items[0].header_cta == "Version1 " %}
{% elsif items[0].header_cta == "Version2" %}
{% elsif items[0].header_cta == "Version3" %}
{% endif %}
- Embed/Add each content block within your email template e.g:
<a href="{{content_blocks.${header_cta-content_block}}}" ><img src="{{content_blocks.${header_img-content_block}}}" /></a>
- When a user preferences changes, update the 'version' within the 'Catalog-SSOT' catalog field/s (manually via CSV or via Catalog API or CDI)
- When content versions change, update the corresponding content block (manually or via the content block endpoint)
Example of 'Catalog-SSOT' fields and items:
I hope this helps, Happy Xmas!
Related Content
- 2 months ago
- 2 years ago
- 7 months ago
- 6 months ago