Can't avoid to escape `<`


I’ve a microtemplate which needs some logic, but I can’t avoid the encoding not even using safeHTML:

<script id="tmpl-group-tracks" type="text/x-jsrender">

{%if valid_time &lt; 30%}

Thank you!

@robsonsobral I’m missing something here. Is this the output or the desired output? Would you mind adding a bit more of your templating please? :smile:

I’m sorry! That’s the output.

The desired output is:

<script id="tmpl-group-tracks" type="text/x-jsrender">
{%if valid_time < 30%}

See the < after valid_time?

Everything is inside a partial.

I’m pretty sure we had exactly the same question in a thread a day or two ago.

Thank, @bep

I found it

I still don’t know how to make the Output Formats work for my microtemplates partials, but I gonna try to.

Thank you.

A tip: You can include plain text partials into HTML partials (in Hugo >0.20); so having a partials with suffix txt, js or json with the full script tag should work, I believe.

Sooooo… It could be even a .template file?

Interesting… Thank you!

Yes, but I mentioned the above because they are built-in media types (MIME types) in Hugo, so no work …