{"record":{"id":"35f7e32ddb099e8a","repo":"getzola/zola","slug":"found-broken-internal-anchor-link-s","errorCode":null,"errorMessage":"Found {} broken internal anchor link(s)\n{}","messagePattern":"Found (.+?) broken internal anchor link\\(s\\)\n(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"components/site/src/lib.rs","lineNumber":369,"sourceCode":"\n        // Needs to be done after rendering markdown as we only get the anchors at that point\n        let internal_link_messages = link_checking::check_internal_links_with_anchors(self);\n\n        // log any broken internal links and error out if needed\n        if !internal_link_messages.is_empty() {\n            let messages: Vec<String> = internal_link_messages\n                .iter()\n                .enumerate()\n                .map(|(i, msg)| format!(\"  {}. {}\", i + 1, msg))\n                .collect();\n            let msg = format!(\n                \"Found {} broken internal anchor link(s)\\n{}\",\n                messages.len(),\n                messages.join(\"\\n\")\n            );\n            match self.config.link_checker.internal_level {\n                config::LinkCheckerLevel::Warn => log::warn!(\"{msg}\"),\n                config::LinkCheckerLevel::Error => return Err(anyhow!(msg)),\n            }\n        }\n\n        // check external links, log the results, and error out if needed\n        if self.config.is_in_check_mode() && self.check_external_links {\n            let external_link_messages = link_checking::check_external_links(self);\n            if !external_link_messages.is_empty() {\n                let messages: Vec<String> = external_link_messages\n                    .iter()\n                    .enumerate()\n                    .map(|(i, msg)| format!(\"  {}. {}\", i + 1, msg))\n                    .collect();\n                let msg = format!(\n                    \"Found {} broken external link(s)\\n{}\",\n                    messages.len(),\n                    messages.join(\"\\n\")\n                );\n                match self.config.link_checker.external_level {","sourceCodeStart":351,"sourceCodeEnd":387,"githubUrl":"https://github.com/getzola/zola/blob/61d30828217957120309db657950224edf9707e2/components/site/src/lib.rs#L351-L387","documentation":"During load in check mode, Zola validates every internal link's #anchor against the target page's heading anchors. When internal_level is set to Error and any internal anchor links are broken (the anchor doesn't exist on the target page), load returns this error listing each bad link.","triggerScenarios":"Calling zola check (or Site::load with check mode) where a markdown link like [x](@/page.md#missing-anchor) or [](...#anchor) references an anchor that does not exist in the rendered target page; internal_level = \"error\" in config link_checker.","commonSituations":"Renaming or deleting a heading in a target page that other pages link to with a #fragment; editing a heading without updating slugified anchors; typos in anchor names.","solutions":["Fix or remove each listed broken anchor link in your markdown","Re-run zola check until zero broken anchors are reported","Temporarily set link_checker.internal_level = \"warn\" in config.toml if you only want warnings instead of a failing build","Use exact heading text — anchors are slugified from headings, so renamed headings change the anchor"],"exampleFix":"// before (content.md)\n[details](@/guide.md#configuration)\n// after (heading in guide.md is \"## Configuring the site\")\n[details](@/guide.md#configuring-the-site)","handlingStrategy":"validation","validationCode":"// Run zola check in CI before building:\n// zola check && zola build\n// Or keep anchors consistent: link only to headings whose slug you verify","typeGuard":null,"tryCatchPattern":"// Treat broken-anchor reports as warnings by configuring:\n// [link_checker]\n// internal_level = \"warn\"\n// then inspect warnings in build output","preventionTips":["Run `zola check` in CI on every PR","Never rename/delete headings without grepping for '#'-links to them","Link to stable section anchors rather than frequently edited headings"],"tags":["rust","link-checker","anchors"],"backgroundTag":"broken-internal-link","analyzedSha":"61d30828217957120309db657950224edf9707e2","analyzedAt":"2026-09-03T14:39:09.727Z","contentChangedAt":"2026-09-03T14:39:09.727Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}