Right I was not aware of all the background either. Thank you @jmooring for posting all these links.
@shaform and anyone else.
There is a manual way to use footnotes with unique IDs in Hugo.
I’ve used it at some point because I needed to display footnotes at the end of a text block and not at the end of a HTML page.
The concept is kind of simple.
- Define a custom
footnote
shortcode under /layouts/shortcodes/footnote.html
:
<sup class="footnote-ref" id="{{ .Get 0 }}fnref:-"><a href="#{{ .Get 0 }}fn:-">*</a></sup>
- Define a custom
citation
shortcode in a similar PATH as above:
<li id="{{ .Get 0 }}fn:-">{{ .Get 1 }}<a class="footnote-return" href="#{{ .Get 0 }}fnref:-">^</a></li>
- Define a custom
footnotesList
shortcode that will contain the nested citation
shortcode along with the desired HTML:
<div class="footnotes">
<hr>
<ol>
{{ .Inner }}
</ol>
</div>
- Then in a content file call the above like so:
Lorem Ipsum {{< footnote "ipsum" >}}
{{< footnotesList >}}
{{< citation "ipsum" "Ipsum maximus metus vel erat luctus, vitae imperdiet neque iaculis." >}}
{{< /footnotesList >}}
The above is tested and it works with multiple footnotes.
For my purposes I use an asterisk as a footnote reference. Obviously you can customize the shortcodes to use numbering or to output the HTML that suits your purposes.
Anyway, the bottom line is that while we wait for gohugoio/hugo/#7508 to be resolved there is a manual workaround to output footnotes without clashing IDs on list pages right now.
Of course for many footnotes the above may be an overkill.
But anyway you get the idea, it can always be improved.