Open McShelby opened 1 month ago
Is this intended?
No, but I'm assuming you're doing something ... unusual that we didn't think of when we implemented this. Because it doesn't always happen.
Hm. I stripped the sample down to the bones. In my view, nothing special here.
This usage is unusual:
{{- range .Page.Pages }}
<h3>{{ .Title | safeHTML }}</h3>
<div>{{ .RenderShortcodes | safeHTML }}</div>
{{- end }}
I suggest you read the documentation and/or start a thread in the forum about the intention/use cases of .RenderShortcodes
. It's a method with very limited but useful use: Including markdown in markdown, so to speak.
For others who may come around: The artifacts seem to be avoided if the shortcode is changed by adding a blank line in front of .RenderShortcodes
.
{{- range .Page.Pages }}
<h3>{{ .Title | safeHTML }}</h3>
<div>
{{ .RenderShortcodes | safeHTML }}
</div>
{{- end }}
For others who may come around:
Please read and understand the documentation at https://gohugo.io/methods/page/rendershortcodes/ and consider if you really need to use this method. It is very useful, but it a special purpose method
.
If you wrap your .RenderShortcodes
in a div
and pipe it to safeHTML
, the answer is no
.
Configured
renderer.unsafe=true
and then using.RenderShortcodes
in a shortcode used with%
generates artifacts in the form of{{__hugo_ctx pid=3}}
.Is this intended?
This can be seen in the sample repo in http:/localhost:1313/posts
https://github.com/McShelby/hugo-testing/tree/hugo-issue-12854
What version of Hugo are you using (
hugo version
)?Does this issue reproduce with the latest release?
Yes. The used version was the latest.