Mastodon shortcode redux

site features

I previously installed a Mastodon embed shortcode for Hugo. However, it stopped working when Hugo 0.60.0 was released because Hugo switched to using the Goldmark Markdown parser, which is more strict. In particular, it refuses to process raw HTML by default.

Fortunately, there are a couple of workarounds: either set your site to be “unsafe”, or for some reason you can also simply change from invoking your shortcode with {{% (as instructed by the person who originally wrote the Mastodon shortcode) to using the {{< delimiter, as Bep himself recommended. I don’t really understand why it works when you replace a % with <, but whatever gets the job done. (Update: apparently % causes the contents to be sent through Hugo’s content renderer, while < does not.)

That leaves the question of how one can safely refer to those magic characters without triggering a Hugo shortcode! The solution seems to be to replace one or more necessary characters with an HTML entity.

I leave you with a toot as your reward for reading all the way through this post, so you can celebrate with me the return of Mastodon shortcodes to this site: