Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
serriadh opened this issue Nov 27, 2024 · 0 comments
Labels

Comments

@serriadh
Copy link

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.

@Keats Keats added the bug label Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants