Hugo: Unable to use shortcodes

Created on 24 Feb 2017  Â·  2Comments  Â·  Source: gohugoio/hugo

Trying any shortcode (using hugo server -w .) has been giving me:

ERROR 2017/02/24 11:16:23 0 : template: theme/index.html:32: unexpected "<" in command

Example:

{{< tweet 666616452582129664 >}}

Do I need to do anything to include them? I'm running go 1.8 on mac and hugo v0.19-DEV

Most helpful comment

In case other people stumble upon this. I can confirm that shortcodes to not work inside partials.

All 2 comments

Woops, looks like I missed this in the docs:

A shortcode is a simple snippet inside a content file that Hugo will render using a predefined template. Note that shortcodes will not work in template files—

I think this is slightly confusing though, because I don't think they work in partial templates either, unless there's a way to include a partial template in a content file.

if you need a functionality like that in a template, you most likely want a partial template instead.

In case other people stumble upon this. I can confirm that shortcodes to not work inside partials.

Was this page helpful?
0 / 5 - 0 ratings