N
Novu10mo ago
Mei

Digest templates with 1 event total

It appears that digests that end up having only one trigger by the time they expire still pass step.digest and step.events to templates. Is there a suggested way to have a template still render a single-event branch in this case? I don’t think I can do an equality check of step.events.length and 1 inside the handlebars template, can I?
5 Replies
Pawan Jain
Pawan Jain10mo ago
@Mei How about using condition in template https://docs.novu.co/workflows/digest#writing-digest-templates
Mei
MeiOP10mo ago
How exactly does one write a condition that checks if the length of the list is 1? You can’t just write {{#if step.events.length = 1}}
Mei
MeiOP10mo ago
Thanks!
Pawan Jain
Pawan Jain10mo ago
{{#equals step.toal_count 1}}
<!-- Code to execute when value1 is equal to value2 -->
{{else}}
<!-- Code to execute when value1 is not equal to value2 -->
{{/equals}}
{{#equals step.toal_count 1}}
<!-- Code to execute when value1 is equal to value2 -->
{{else}}
<!-- Code to execute when value1 is not equal to value2 -->
{{/equals}}
Want results from more Discord servers?
Add your server