Escape Shortcode in Hugo

Once in a while, you might want to print the shortcode instructions into your page content instead of getting it rendered. This is called escaping and fortunately, Hugo has a built-in method to perform such action.

Escaping Shortcode

To escape a shortcode, you simply need to add comment syntax at the shortcode braces as such:

{{</* link "/img/sample.png" "this" "url-only" */>}}

This will be rendered as:

{{< link "/img/sample.png" "this" "url-only" >}}

Note that you can perform deeper level commenting in order to print the escaped shortcode like the above (as in, escaping the escaped shortcode).

Wrapping Up

That is all for escaping shortcode with Bissetii in Hugo. If you have any question to ask us directly, please feel free to raise it at our GitLab Issues Section. We will be happy to assist you.