I’m trying to get a custom shortcode to output an HTML style
tag.
css.html shortcode:
<style class="example-css">
{{ printf "%s" .Inner | safeHTML }}
</style>
sample use:
{{% css %}}
body {
background: green;
}
{{% /css %}}
expected output:
<style class="example-css">
body {
background: green;
}
</style>
actual output:
<style class="example-css">
ZgotmplZ
</style>
Not sure why Hugo is generating that random text. I just need it to pass through the code passed into the shortcode as plain text. Note that if my shortcode uses a div
instead of a style
tag, it works as expected (but doesn’t apply CSS like I need it to).