I’m trying to include a footnote in a partial I’ve created. The partial is super simple and essentially just wraps the {{ .Inner }} in a div. Something like this:
{{< callout >}}
This is my content
{{< /callout > }}
This seems to work for most things I throw at it… except footnotes. Which completely fail to render.
As a dev I can see why this might be the case but I don’t think it really should be intended behaviour? I tried to solve it by turning unsafe markup on and simply including the div html in my post markdown but then the renderer failed to process any markdown I had between the two divs.
Mmm. Bit difficult without a lot of cruft but I hope this clarifies.
{{< callout >}}
This is my content with a footnote[^1]
{{< /callout > }}
[^1]: This would be the footnote that you see.
I’m expecting to see on my page:
<div class="callout">
<p>
This is my content with a footnote
<sup id="fnref:1">
<a href="#fn:1" class="footnote-ref" role="doc-noteref">
1
</a>
</sup>
</p>
</div>
<section class="footnotes" role="doc-endnotes">
<hr>
<ol>
<li id="fn:1" role="doc-endnote">
<p>
This would be the footnote that you see. <a href="#fnref:1" class="footnote-backref" role="doc-backlink">↩︎</a>
</p>
</li>
</ol>
</section>
What I actually get is:
<div class="callout">
<p>
This is my content with a footnote[^1]
</p>
</div>
Notice that not only does the link not get created but the footnote section is entirely missing.
{{% callout %}}
This is my content
{{% /callout %}}
Because of the % delimiters markdownify is not needed and the content is rendered with global context. The new lines in the shortcode somehow have an impact on what is rendered as markdown and what left as html.
Additionally, I use the configuration
markup:
goldmark:
renderer:
unsafe: true
I am quite new to Hugo so I don’t have full understanding here, but still hope it is helpful.
@hacky86 Please do not keep bumping up old topics, especially those several years old. Please do not keep posting essentially the same response to multiple topics. Please read Help keep this forum practical .