# How to render the following template?

**URL:** https://discourse.nodered.org/t/how-to-render-the-following-template/54869
**Category:** General
**Created:** [8 December 2021 11:36 UTC](https://discourse.nodered.org/t/how-to-render-the-following-template/54869 "2021-12-08T11:36:43Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![gitmirko](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gitmirko/32/52271_2.png) [@gitmirko](https://discourse.nodered.org/u/gitmirko)
#### Post date: [8 December 2021 11:36 UTC](https://discourse.nodered.org/t/how-to-render-the-following-template/54869/1 "2021-12-08T11:36:43Z")

</div>

Hi,  
I'm struggling for hours to find the right approach to render the following template to be rendered by Home Assistant at the end.

Right now I was able to use the template node to render the following template:

```auto
state_attr("{{{flow.entity_id}}}", "volume_level")*{{{flow.volume_factor}}}|float

```

Is there any way to render this kind of template while preserving the double curly braces at the beginning and the end? If so I should be able to pass the output to node-red-contrib-home-assistant-websocket (api-render-template) directly and finaly achive my goal 🙂

```auto
{{ state_attr("{{{flow.entity_id}}}", "volume_level")*{{{flow.volume_factor}}}|float }}

```

Best regards  
Mirko

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [8 December 2021 11:39 UTC](https://discourse.nodered.org/t/how-to-render-the-following-template/54869/2 "2021-12-08T11:39:46Z")

</div>

Hi @gitmirko , welcome to the forum.

I assume you are using the core Template node for this?

If you check the sidebar help for that node, it explains what to do if you need `{{`/`}}` to appear in the generated content:

> If you need to use `{{ }}` within your content, you can change the characters used to mark the templated sections. For example, to use `[[]]` instead, add the following line to the top of the template:  
> `{{=[[]]=}}`

---

<div class="post-metadata">

### Author: ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)
#### Post date: [8 December 2021 11:56 UTC](https://discourse.nodered.org/t/how-to-render-the-following-template/54869/3 "2021-12-08T11:56:08Z")

</div>

Example

```auto
{{=<% %>=}} {{ <%={{ }}=%>state_attr("{{{flow.entity_id}}}", "volume_level")*{{{flow.volume_factor}}}|float }}

```

---

<div class="post-metadata">

### Author: ![gitmirko](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gitmirko/32/52271_2.png) [@gitmirko](https://discourse.nodered.org/u/gitmirko)
#### Post date: [8 December 2021 11:57 UTC](https://discourse.nodered.org/t/how-to-render-the-following-template/54869/4 "2021-12-08T11:57:45Z")

</div>

Thank you. This worked like a charm:

```auto
{{=[[]]=}}
{{ state_attr("[[flow.entity_id]]", "volume_level")*[[flow.volume_factor]]|float }}

```

I still have not found the part in the help where it states this information.

---

<div class="post-metadata">

### Author: ![gitmirko](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gitmirko/32/52271_2.png) [@gitmirko](https://discourse.nodered.org/u/gitmirko)
#### Post date: [8 December 2021 11:58 UTC](https://discourse.nodered.org/t/how-to-render-the-following-template/54869/5 "2021-12-08T11:58:59Z")

</div>

Thank you as well. I got it to work with the first approach right away.

---

<div class="post-metadata">

### Author: ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)
#### Post date: [8 December 2021 12:10 UTC](https://discourse.nodered.org/t/how-to-render-the-following-template/54869/6 "2021-12-08T12:10:55Z")

</div>

Think it depends on node-red version but there is a link in the help to this page. [mustache(5) - Logic-less templates.](http://mustache.github.io/mustache.5.html)

I see in your use of change delimiter, you no longer require that html entities are not escaped i.e the {{{ has become [[.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [22 December 2021 12:11 UTC](https://discourse.nodered.org/t/how-to-render-the-following-template/54869/7 "2021-12-22T12:11:47Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
