Hugo

Shortcodes parsing, but not doing anything

I can’t get any inline shortcodes to work. They just render straight through on the output page as I entered them. For example,

{{< vimeo 74130826 >}}

ends up exactly like that in the rendered page, as does any shortcode I enter. What’s interesting is that if I enter an invalid shortcode, like

{{< barf 12345 >}}

hugo complains at compile time:

failed to extract shortcode: template for shortcode “barf” not found

So it’s parsing them, but not actually rendering them. This is true for all the shortcodes I’ve tried (highlight, youtube, vimeo, tweet).

I have enableInlineShortCodes = true in my config.toml.

Version output: Hugo Static Site Generator v0.63.0-DEV/extended linux/amd64 BuildDate: unknown

The example you provide isn’t “inline shortcodes”, but that does not seem to be your problem. How do you include the page content in your templates?

I’m still at the “hello world” stage with Hugo, and am not creating or editing any templates.

I’m just trying to put my first test post up according to the Quickstart documentation. I installed Hugo and a theme (MemE) according to the instructions, which seems to have worked. And then:

hugo new posts/first-post.md
vi posts/first-post.md # put some content in there
hugo server --bind 0.0.0.0

I think it might be processing them somewhere, only not where you’re looking.

Do you have a repo somewhere?

I do not have a repo. If you can point me toward an example, I’ll set one up to parallel it.

I usually use @zwbetz’s example site repo: https://github.com/zwbetz-gh/starter-hugo-debug-site

You can download as a zip and init as a fresh new repo!

Thanks.

1 Like

OK, so using that repo, it worked.

Any tips for how to debug this on my site would be appreciated.

Hard to guess without seeing your code. Maybe others will take the challenge though.

Except I don’t have any code…I just installed a theme and created a single markdown file with two lines of content. So I guess the answer must be that I installed the theme wrong, or it’s broken. I’ll try some other theme, and then if that’s still jacked, I guess I’ll start debugging the go code.