mkdocs-material: Version switcher lately never succeeds at staying on the same page
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 https://github.com/squidfunk/mkdocs-material/commit/a6282931efa2a79665333d41e50bc532367b671a, specifically the changes to the fetchSitemap and extract functions.
After that commit, something clearly wrong is happening in:
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.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16 (15 by maintainers)
Commits related to this issue
- docs: downgrade `mkdocs-material` I'm hoping this will fix version switching. https://github.com/squidfunk/mkdocs-material/issues/7160 — committed to ilyagr/jj by ilyagr 3 years ago
- docs: downgrade `mkdocs-material` I'm hoping this will fix version switching. https://github.com/squidfunk/mkdocs-material/issues/7160 — committed to jj-vcs/jj by ilyagr 3 years ago
- docs: try upgrading `mkdocs-material` again https://github.com/squidfunk/mkdocs-material/issues/7160 is supposed to be fixed now. I will double-check that the version switcher still works after this ... — committed to ilyagr/jj by ilyagr 3 years ago
- docs: try upgrading `mkdocs-material` again, upgrade MkDocs https://github.com/squidfunk/mkdocs-material/issues/7160 is supposed to be fixed now. I will double-check that the version switcher still w... — committed to ilyagr/jj by ilyagr 3 years ago
- docs: try upgrading `mkdocs-material` again, upgrade MkDocs https://github.com/squidfunk/mkdocs-material/issues/7160 is supposed to be fixed now. I will double-check that the version switcher still w... — committed to ilyagr/jj by ilyagr 3 years ago
- docs: try upgrading `mkdocs-material` again, upgrade MkDocs https://github.com/squidfunk/mkdocs-material/issues/7160 is supposed to be fixed now. I will double-check that the version switcher still w... — committed to ilyagr/jj by ilyagr 3 years ago
- docs: try upgrading `mkdocs-material` again, upgrade MkDocs https://github.com/squidfunk/mkdocs-material/issues/7160 is supposed to be fixed now. I will double-check that the version switcher still w... — committed to ilyagr/jj by ilyagr 3 years ago
- docs: try upgrading `mkdocs-material` again, upgrade MkDocs https://github.com/squidfunk/mkdocs-material/issues/7160 is supposed to be fixed now. I will double-check that the version switcher still w... — committed to ilyagr/jj by ilyagr 3 years ago
- docs: try upgrading `mkdocs-material` again, upgrade MkDocs https://github.com/squidfunk/mkdocs-material/issues/7160 is supposed to be fixed now. I will double-check that the version switcher still w... — committed to jj-vcs/jj by ilyagr 3 years ago
Perhaps you could try checking out my hunch about the URLs that are stored in the sitemap:
However, I see that your site has different URLs in the sitemap, so the hunch is likely incorrect 🤔 It properly stores the current
/version/in the URLs, instead of reusing a static one.This “shadow” issue has been here for quite some time, good that someone is willing to properly debug it 💪