Shortcodes not working on Netlify or locally

I’m rather baffled why shortcodes are non-functional on my site. In an earlier version a year ago they worked. I was trying to use the code highlight shortcode, which did not work even though I used the recommended CSS.

I’ve tried to run code locally (hugo server) and on Netlify and neither works.

A sample od previously working but now not working code is to be found here -

My code repo is to found here -

Any help in trying to figure out what is wrong is greatly appreciated.


Hi @sakumatto !
Feel free to ask also on :


Thanks @amalik, I’ll consider that also, yet for the time being I’m quite sure this is a Hugo vs me issue as the problem arises even when running “hugo server” from memory.

You did not mention what version of hugo you are currently using but I’m certain this might solve your issue: Goldmark breaks shortcode

Hi @benmarte, sounds like a solid bit of advice. I was not aware of this change away from blackfriday. I toyed around a bit with this but thus far I did’nt get the shortcodes working, but I’ll continue. Thanks for the hint.

Feel free to let us know @sakumatto :wink:

More on shortcodes there, even though I know you read it already :


Hi again @amalik, I’m still fighting with this issue and additionally I found out that Goldmark does not render correctly, so I’m thinking that these issues are connected.

I made a sample page and it’s not turning links into links nor is it turning paragraphs into paragraphs.

Up until now I’ve always written everything in straight html so I have not had a reason to notice this issue, but with Goldmark, I decided to start trying out markdown so now I noticed this problem.

Locally - Hugo Static Site Generator v0.68.3/extended darwin/amd64
On Netlify - HUGO_VERSION 0.65.3

Do you have any hint where to look for this to be fixed?


Just to update the issue I am (still) experiencing.
I’ve now switched to the newest Hugo version and still shortcodes are nowhere near to be working.

  • HUGO_VERSION 0.78.1
    I tried to utilise the search function that was presented here a week back, but alas, same issue of non-working short codes prevents this search from working aswell.
  1. Use {{% instead of {{<
  2. set the following in your configuration:
          unsafe: true

If that does not help then update your repo with these changes and we’ll check it out. Right now it does not have these changes.

Thanks for the kind help! I did what you said, so my config.toml:

  • [markup]
    defaultMarkdownHandler = “goldmark”
    unsafe = true
    and the search word is now: {{% search %}}

Unfortunately there is no change in the not working. The repo was obviously also updated, as requested. Any and all help much appreciated @gethugothemes.

It turns out the problem is not the shortcodes. All your templates use the following to show the page content:

<div>{{ .RawContent | safeHTML }}</div>

This takes whatever is in your .md file and transforms it so that all special characters are shown in the page output. It also takes care that your shortcodes are displayed as is and not parsed :wink:

<div>{{ .Content }}</div>

Then change the {{% back to {{< where you changed it based on my answer before and it will work.


OK, or should I say OMG. I remember running into problems earlier on where I changed the -Content to what you point out and months later I wasn’t able to put two and two together.
Thanks a bunch for you help on this, I’ll get to it after the office day!

If you use normal HTML-comment tags in your templates (<!-- and -->) you can make notes. These comments will be removed when the site gets generated so it’s quite useful for reminders.

You are spot on with your comment, thanks!

This did it, super big thanks for your insight. A newbie is sometimes totally lost and this was the eye-opener I needed.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.