getzola / zola

A fast static site generator in a single binary with everything built-in. https://www.getzola.org
https://www.getzola.org
MIT License
13.58k stars 950 forks source link

Internal anchors can be added by templates #2417

Open clarfonthey opened 8 months ago

clarfonthey commented 8 months ago

Zola version: 0.18.0


Because templates can add extra anchors, the internal link checker has false negatives when linking directly to these anchors. There are a few options to getting around this, namely:

  1. Make the internal link checker fully render a template and use the external link checker code if there's an error, to verify that it's not added by a template. This could potentially be disabled by default because it's slow.
  2. Add options to disable the link checker for particular internal pages (e.g., allow any anchor on @/page.md when linking).
  3. Add the ability to tell zola about custom anchors in front matter, and/or the global configuration for anchors added to every page (like a return-to-top anchor).

Note that any combination of these could be implemented, but I don't want to be too prescriptive about the solution since there are multiple and it depends on what people would be comfortable with.

Keats commented 8 months ago

See https://github.com/getzola/zola/pull/2264

We are not going to check anchors added by templates