-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Description
Bug description
(Update: This reproduction no longer works -- or rather, there is no bug, everything works as intended -- after I downgraded that website to be compiled with the old 9.5.4 version of mkdocs-material. It should be possible to reproduce this with https://github.com/squidfunk/mkdocs-material-example-versioning, but it requires recompiling that website with a recent version of mkdocs-material)
- Go to https://martinvonz.github.io/jj/prerelease/config/
- Use the version switcher to switch to the "v0.17.0" version
Observed: you end up at https://martinvonz.github.io/jj/v0.17.0/
Desired behavior: you should end up at https://martinvonz.github.io/jj/v0.17.0/config/
Context
I can flesh out this bug report if desired, but I believe I found the likely culprit to be a628293, specifically the changes to the fetchSitemap
and extract
functions.
After that commit, something clearly wrong is happening in:
mkdocs-material/src/templates/assets/javascripts/integrations/version/index.ts
Lines 135 to 139 in c1336ae
const location = getLocation() | |
const path = location.href.replace(config.base, "") | |
return sitemap.has(path.split("#")[0]) | |
? new URL(`../${version}/${path}`, config.base) | |
: new URL(url) |
As I debug, with the reproduction I describe below, I find that sitemap
is a Map
object with value (as abbreviated by the Firefox debugger):
Map(31) {
"https://martinvonz.github.io/jj/v0.17.0/" → (1) [...],
"https://martinvonz.github.io/jj/v0.17.0/FAQ/" → (1) [...],
"https://martinvonz.github.io/jj/v0.17.0/branches/" → (1) [...],
... }
```
Meanwhile, path.split("#")[0]
has the value "config/". So, the operation sitemap.has(path.split("#")[0])
cannot evaluate to true
.
Related links
Reproduction
See description
Steps to reproduce
See description
Browser
Firefox 125.0.3 on Mac OS Sonoma
Before submitting
- I have read and followed the bug reporting guidelines.
- I have attached links to the documentation, and possibly related issues and discussions.
- I assure that I have removed all customizations before submitting this bug report.
- I have attached a .zip file with a minimal reproduction using the built-in info plugin.