{% load wagtailcore_tags %}

{% if page.footnotes_list %}
    <div class="footnotes" id="footnotes">
        <h2 id="footnote-label">
            Footnotes
        </h2>
        <ol>
            {% for footnote in page.footnotes_list %}
                <li id="footnote-{{ forloop.counter }}">
                    [{{ forloop.counter }}] {{ footnote.text|richtext }}
                    <a href="#footnote-source-{{ forloop.counter }}" aria-label="Back to content">↩</a>
                </li>
            {% endfor %}
        </ol>
    </div>
{% endif %}
