Using footnotes in shortcodes

I added the following short code called collapse-entry

<h2>
<a class="accordion-button collapsed" style="font-size:48px;" data-bs-toggle="collapse" href="#{{ .Get "id" }}" role="button" aria-expanded="false" aria-controls="{{ .Get "id" }}">
  {{ .Get "title" }}
</a>
</h2>
<div class="collapse" id="{{ .Get "id" }}">
  <div class="accordion-body">
  
    {{ .Inner | markdownify }}

    {{ if .Get "img" }}
    <figure>
      <img src="{{ .Get "img" }}">
    </figure>
    {{ end }}
		
  </div>
</div>

to be able to have single collapsible entries.

One of the entries contains footnotes ([^]) as described here under “Adding a footnote”.

Unfortunately, the footnotes don’t get rendered. As an example, one of the rendered output is de la population[^note2]. Now my question is, how can I use footnotes in short codes?

Hi there,

Do you have your code somewhere we can clone and replicate? It’s easier to help if we can clone instead of guessing and recreating your setup.

Hi @pointyfar

You can find the file here (Search for [^note2] to find the relvant code). As a workaround, I moved the footnotes within the shortcode. You can find this “new” version here.

I realized just now that if I move the notes within the short code, the footnote outside doesn’t work anymore and links to the footnote within the short code because the footnotes in the short code (re-)start at 1. Is there any way to fix this behavior?