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

Ignore links to #top when checking anchors #2495

Open
Lucidiot opened this issue May 10, 2024 · 1 comment
Open

Ignore links to #top when checking anchors #2495

Lucidiot opened this issue May 10, 2024 · 1 comment

Comments

@Lucidiot
Copy link

Bug Report

Environment

Zola version: 0.18.0

Expected Behavior

The HTML spec includes some special handling for a #top fragment added to the URL:

  1. If decodedFragment is an ASCII case-insensitive match for the string top, then return the top of the document.

This means that adding [some text](#top) to a page correctly creates a link to the top of the page, and Zola should treat the link as always being valid since the anchor is technically always there.

Current Behavior

$ zola check
Checking site...
Checking all internal links with anchors.
> Checked 1 internal link(s) with anchors: 1 target(s) missing.
Failed to check the site
Error: The anchor in the link `@/index.md#top` in /tmp/testsite/content/index.md does not exist.

Steps to reproduce

Add a Markdown link to #top in any page, and run zola check.

Workaround

Linking to # can work instead, as the HTML spec also defines it as an edge case:

  1. If fragment is the empty string, then return the special value top of the document.
@Keats
Copy link
Collaborator

Keats commented May 12, 2024

I didn't know that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants