Consider the following snippet. The value of $bar
is used as an HTML class name and a JS variable name (foo42 is valid variable name in JS).
{{$bar := 42}}
<div class="foo{{$bar}}">
</div>
<script>
var foo{{$bar}} = 42;
</script>
The output is:
<div class="foo42">
</div>
<script>
var foo 42 = 42;
</script>
And it is the same using {{- $bar -}}
. It seems like Hugo wants to prevent me generating JS. But why???
version: Hugo Static Site Generator v0.55.6/extended linux/amd64 BuildDate: unknown