Forum Discussion
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 if I had two items the second one didn't render. I'm not sure if I'm missing some tricks or it's not possible but I'm currently having issues getting it to render reliably each time.
The longer end goal is to render a series of emails based on user paths but use catalogs as the single source of truth for content and avoid going in and out of a canvas. I know I can build the emails with HTML in the canvas and pull in the copy, that works good. Was just testing if I can pull in entire sections of code as well.
Open to any advice, tips and tricks.
Thanks š
- MaggieBrennanCommunity Manager
Hey DavidO! I will bring this back to our team and see what I can find out for you.
- StuartPractitioner 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!
- abentonPractitioner II
Hoping someone with an answer chimes in - also curious about this!
Related Content
- 3 months ago
- 2 years ago
- 8 months ago
- 6 months ago