email - Nesting liquid tag to select a list item
问题描述
Hey I'm wondering if you could help me with some Liquid coding I am struggling with.
I am using Liquid with customer.io in order to code an email template.
customer.io uses data from user attributes e.g {{customer.sub_speciality_id}}
as well as data from a trigger sent as a JSON e.g {{trigger.test}}
I am using the following tag {{trigger.sub_specialities.3[0].title}}
Which looks in the JSON under for the values from the key "sub_specialities" it then chooses the section whose key is "3" which is a list, then picks the first item in that list and returns the title
That works fine.
But what I would like to do is to replace 3
with a liquid tag based off the customer attribute sub_speciality
which is stored as {{customer.sub_speciality_id}}
so in a way {{trigger.sub_specialities.{{customer.sub_speciality_id}}[0].title}}
But I know you can't do liquid like that. How would I go about doing that?
解决方案
推荐阅读
- powershell - 电子邮件正文中的 Power shell 新行
- c++ - 在 C++ 类中具有类类型属性有什么用?
- logging - Logback 过滤器不会过滤掉所需的类
- typescript - 在 TypeScript 中禁用 TS2554
- cmake - cmake 在源目录中构建,而不是 PWD
- powershell - 将两个或三个 azure cmdlet 导出到 powershell 中的相同 .csv
- pulumi - 如何禁用 pulumi 中的版本检查输出?
- r - R sumif 基于多个条件
- matlab - 如何在使用 MATLAB Class 文件夹创建的类对象中公开成员?
- html - 选择所有跨区文本时如何获取元素?