Skip to content

Footnotes incorrectly labelled where they appear above and below a <!-- more --> #2713

Open
@serriadh

Description

@serriadh

Bug Report

Environment

Zola version: 0.19.2

Expected Behavior

A page of the form

+++
title="Test"
date="2024-11-27"
+++

Paragraph 1[^1].

<!-- more -->

Paragraph 2[^2]. 

[^1]: Footnote 1
[^2]: Footnote 2

should be rendered something like

Paragraph 1 (1)
Paragraph 2 (2)
----
1: footnote 1
2: footnote 2

Current Behavior

It actually renders with unexpected label order, or with repeated labels, eg.

Paragraph 1 (1)
Paragraph 2 (1)
----
2: footnote 1
1: footnote 2

Example output with the hyde theme:

image

The HTML generated by hyde looks like this:

<div class="post">
    <h1 class="post-title">Test</h1>
    <span class="post-date">2024-11-27</span>
    <p>Paragraph 1<sup class="footnote-reference"><a href="[#1](view-source:http://127.0.0.1:1111/test/#1)">1</a></sup>.</p>
<span id="continue-reading"></span>
    <p>Paragraph 2<sup class="footnote-reference"><a href="[#2](view-source:http://127.0.0.1:1111/test/#2)">1</a></sup>.</p>
    <div class="footnote-definition" id="1">
        <sup class="footnote-definition-label">2</sup>
        <p>Footnote 1</p>
    </div>
    <div class="footnote-definition" id="2">
        <sup class="footnote-definition-label">1</sup>
        <p>Footnote 2</p>
    </div>
</div>

Note that the footnote IDs are correct, it is just the labels which are incorrect.

Step to reproduce

A bare minimum zola setup with the example markdown page above shows the issue, at least to me. I've checkedit with the hyde and lightspeed themes.

Removing the <!-- more --> element, or shifting all the footnote links above or below the <!-- more --> makes the problem go away. It only happens when there's at least one footnote reference above the fold, and one below it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions