HUGO

Misunderstanding of shortcode syntax in 0.55

Ok. These are good arguments. Thanks again for your help and efforts!

I can speak to this. So the {{% was not really an intentional decision. When I ported that theme, I tried to keep things as same as possible. When the last Hugo shortcode features were released, that particular theme shortcode still “just worked”. So I left it as is. Plus it wouldn’t break things for folks already using the theme.

Now, I did have to update a few of the theme shortcodes. If you’re interested see Fix the following shortcodes to work with new hugo ver: fileTree, ticks · zwbetz-gh/cupper-hugo-theme@5da8f5a · GitHub

Thank you, Zachary! Your comment helps me very much deciding how to use use/differenciate between the two possibilities.

BTW: I love your clean and simple themes and your clear template and shortcode style. I visit your projects regularly!

Happy to help! And as Bep mentioned, if I was writing that shortcode from scratch, I’d use {{<

Appreciate it :slight_smile:

@bep there is still another breaking change though. Consider my example from before:

myshortcode.html:

<div class="notice">
{{ .Inner }}
</div>
{{% myshortcode %}}
Lorem ipsum [dolor](https://example.org) sit amet.
{{% /myshortcode %}}

Now, as we know, this would not render the markdown of the inner content, without specifying | markdonify.

However, even with | markdownify, the output will not be as expected.

Output before 0.55:

<div class="notice">
<p>Lorem ipsum <a href="https://example.org">dolor</a> sit amet.</p>
</div>

Output in 0.55:

<div class="notice">
Lorem ipsum <a href="https://example.org">dolor</a> sit amet.
</div>

It does not render the paragraph.

Another test:

{{% myshortcode %}}
Lorem ipsum [dolor](https://example.org) sit amet.

Consectetuer adipiscing elitr.
{{% /myshortcode %}}

This in turn will render as

<div class="notice">
<p>Lorem ipsum <a href="https://example.org">dolor</a> sit amet.</p>
<p>Consectetuer adipiscing elitr.</p>
</div>

in 0.55 (with {{ .Inner | markdownify }}).

Sure we could use the {{ $_hugo_config :={ “version”: 1 }}} setting. But obviously I would rather continue with the new approach.

One could say that it’s another symptom of the same breaking change. Let us discuss it here:

1 Like