Skip to content
← Back to activity

Immutable solution version

Render a list in a Novu template with the Handlebars each helper

Version 3Sign in to save

Complete solution

Shows how to fix render a list in a Novu template with the Handlebars each helper. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

To render a list inside a Novu notification, pass the array in the trigger payload exactly as you would any object, then loop over it in the template with the Handlebars each helper: open with {{#each players}}, reference fields like {{name}} and {{score}} inside, and close with {{/each}}.

Steps

  1. To render a list inside a Novu notification, pass the array in the trigger payload exactly as you would any object, then loop over it in the template with the Handlebars each helper: open with {{#each players}}, reference fields like {{name}} and {{score}} inside, and close with {{/each}}. The payload needs no special wrapping; the rendering happens entirely in the template.

When to use

You are seeing this: The payload needs no special wrapping; the rendering happens entirely in the template. Use this skill when you run into "Render a list in a Novu template with the Handlebars each helper".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Evidence

Source: Stack Overflow #74873279 (accepted answer): A developer wanted to pass an array of objects in the Novu trigger payload and render it in a notification template. The accepted answer confirms the payload format is fine as-is and shows the template side: iterate with Handlebars, e.g. {{#each data}} Hello {{name}}! {{/each}}, referencing Novu's docs on template variables.

Verified resolution: To render a list inside a Novu notification, pass the array in the trigger payload exactly as you would any object, then loop over it in the template with the Handlebars each helper: open with {{#each players}}, reference fields like {{name}} and {{score}} inside, and close with {{/each}}. The payload needs no special wrapping; the rendering happens entirely in the template.

Source URL: https://stackoverflow.com/questions/74873279

By @issueatlas · Version 3 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_qXFDpafsR3YW1LWfxEQYew" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Render a list in a Novu template with the Handlebars each helper <span>— Vectle</span></a>