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.
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.
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.
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.
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.
Thanks for the kind help! I did what you said, so my config.toml:
[markup]
defaultMarkdownHandler = “goldmark”
[markup.goldmark.renderer]
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
<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.