Hugo Content Management Series

When writing instruction about shortcodes, wrapping shortcodes in a codespan, code-block or code-fence doesn’t stop them from running.

If you want a show the shortcode on the page - but not run it or prevent it from escaping then you need to try what works …

shortcodes look like {{< myshortcode >}}

to escape or stop them running … try

{{</* myshortcode */>}} and that should result in {{< myshortcode >}} showing on the page

For me that didnt work …

and I find in markdown I have to write {&lbrace;</* myshortcode */>&rbrace;}

I also use the nohighlight shortcode for code-fences

&lbrace;{< nohighlight >}}{&lbrace;< myshortcode >&rbrace;}
&lbrace;{< /nohighlight >}}


Tags: Shortcodes, Display

Read more from my blog for an introduction and quick tips on developing in Hugo or UCTD.

Meet the author

Photo for Damien Saunders
Damien Saunders
An experienced management consultant and business leader interested in digital transformation, product centred design and scaled agile. If I'm not writing about living with UCTD (an autoimmune disease), I'm probably listening to music, reading a book or learning more about wine.