ITADN

MkDocs Material tries to fetch sitemap from incorrect alternate URLs

#8576Closedfilips123 创建于 2026-03-18
bug
F
filips123commented
### Context In my `main.html` template override, I have an additional `link rel="alternate"` tags in `{% block extrahead %} ` that point to the Atom feeds for my project releases and commits: ```html <link rel="alternate" href="https://github.com/filips123/PWAsForFirefox/releases.atom" type="application/atom+xml" title="PWAsForFirefox Releases" /> <link rel="alternate" href="https://github.com/filips123/PWAsForFirefox/commits.atom" type="application/atom+xml" title="PWAsForFirefox Commits" /> ``` ### Bug description The [alternate integration](https://github.com/squidfunk/mkdocs-material/blob/master/src/templates/assets/javascripts/integrations/alternate/index.ts) tries to fetch sitemaps for all links specified in `link rel="alternate"`, even if they are not the documentation URLs or are on different domains. In my case, this causes it to request `https://github.com/filips123/PWAsForFirefox/sitemap.xml`, which fails because of CORS (and even without CORS restrictions, it would fail with 404). Although the search/navigation still works (I think), this still seems like a bug and causes errors to be displayed in the browser console. If possible, the alternate integration should detect that these are not alternate URLs for other versions and skip fetching the manifest. This could probably be done by marking the actual alternate documentation links with some other attribute, or by skipping links with type other than HTML. If that is not possible, is there a way to disable this functionality all together? ### Related links - [Reporting a bug](https://squidfunk.github.io/mkdocs-material/contributing/reporting-a-bug/) ### Reproduction I can't create a ZIP file, because it requires overrides to be disabled. However, I believe the error is not directly caused by overrides, but is instead a bug in the alternate handling code... To reproduce this, you can set the following `main.html` override: ```html {% extends "base.html" %} {% block extrahead %} {# Include releases and commits feeds #} <link rel="alternate" href="https://github.com/filips123/PWAsForFirefox/releases.atom" type="application/atom+xml" title="PWAsForFirefox Releases" /> <link rel="alternate" href="https://github.com/filips123/PWAsForFirefox/commits.atom" type="application/atom+xml" title="PWAsForFirefox Commits" /> {% endblock %} ``` ### Steps to reproduce Build a documentation website with the above override. ### Browser Firefox ### Before submitting - [x] I have read and followed the [bug reporting guidelines](https://squidfunk.github.io/mkdocs-material/contributing/reporting-a-bug/). - [x] I have attached links to [the documentation](https://squidfunk.github.io/mkdocs-material/), and possibly related [issues](https://github.com/squidfunk/mkdocs-material/issues) and [discussions](https://github.com/squidfunk/mkdocs-material/discussions). - [ ] I assure that I have [removed all customizations](https://squidfunk.github.io/mkdocs-material/contributing/reporting-a-bug/#remove-customizations) before submitting this bug report. - [ ] I have attached a __.zip file__ with a [minimal reproduction](https://squidfunk.github.io/mkdocs-material/guides/creating-a-reproduction/) using the [built-in info plugin](https://squidfunk.github.io/mkdocs-material/plugins/info/).
关闭于 2026-03-18 3 条评论