Using curly braces in content

I searched here but couldn’t find anything that worked for my needs.

BACKGROUND

I use asciidoctor for content. I’m trying to describe the format of a URL that users specify for an API property. The text is

<external_URL>?key={{<key>}}&value={{<value>}}

I use the angle brackers < > to delimit a replaceable string

{{<key>}} is a Handlebars variable that the API replaces with the specified key. Similar action for <\value>. The resulting URL is dispatched to the destination.

PROBLEM

If I use {{<key>}}, Hugo complains because it thinks I’m referring to a shortcode. I can’t figure out how to escape { and } to prevent this. All the advice I’ve seen is for handling text that is a real shortcode, but I want Hugo to know that this isn’t a shortcode. What (if anything) can I do?

If you replace any one of {, <, >, and } with an equivalent HTML entity, Hugo will not interpret it as a shortcode. For example, I just tested using this and it worked:

{{&lt;key>}}

I hope that helps,
N (fellow Asciidoctor user)

1 Like

Brilliant! That works perfectly. Thank you muchly!:joy: