Sendgrid车把模板数组长度

Sendgrid handlebar template array length

我正在尝试获取数组的长度,但长度似乎只存在于条件中。

数据:

{
    "array": ["a", "b", "c"]
}

在 sendgrid 模板中:

{{array.length}}

电子邮件中没有呈现任何内容(预览正确呈现)。

有解决办法吗?

看来您可以使用 [greaterThan][1] 标签

来自 Sendgrid 文档的示例:

<p>
Hello Ben!
{{#greaterThan (length cartItems) 0}}
 It looks like you still have some items in your shopping cart. Sign back in to continue checking out at any time.
{{else}}
 Thanks for browsing our site. We hope you'll come back soon.
{{/greaterThan}}
</p>