mkdocs-material: Stay on page when switching versions broken for default version

Contribution guidelines

I’ve found a bug and checked that …

  • … the problem doesn’t occur with the mkdocs or readthedocs themes
  • … the problem persists when all overrides are removed, i.e. custom_dir, extra_javascript and extra_css
  • … the documentation does not mention anything about my problem
  • … there are no open or closed issues that are related to my problem

Description

For https://squidfunk.github.io/mkdocs-material/setup/setting-up-versioning/, if I have versions 1.0, 1.1, and 1.2, with latest pointing to 1.2:

  • /latest/page/ -> dropdown 1.0: ok /1.0/page/
  • /latest/page/ -> dropdown 1.1: ok /1.1/page/
  • /latest/page/ -> dropdown 1.2: redirect /1.2/

Expected behaviour

Switching to the permanent link of the current default page should work

Actual behaviour

Redirects to root

Steps to reproduce

Example page https://hatch.pypa.io/latest/config/metadata/

Package versions

  • Python: 3.10.5
  • MkDocs: 1.3.0
  • Material: 8.3.4

Configuration

https://github.com/pypa/hatch/blob/master/mkdocs.yml

System information

  • Operating system: Windows 10
  • Browser: Chrome

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 23 (12 by maintainers)

Most upvoted comments

Actually, I’ve just tested and it seems that version switching has never worked with anchors 😅 Could you please create a new issue? It’s related, but not the same error as this one.

After further investigation, this is entirely a Mike issue, will look into it a bit more and report there. Still not sure why it only recently started happening, but sorry for wasting your time!

Thank you!!!

Released as part of 8.3.5.

Thanks for the fix!!!

Not sure how long but https://github.com/jimporter/mike says:

By default, aliases create a simple HTML redirect to the real version of the docs; to create a copy of the docs for each alias, you can pass --no-redirect.

I do that because I like retaining latest in the URL.