Closed StarfallProjects closed 2 years ago
I am also finding that this:
redirect_map = {
"reference/glossary.md": "../about/",
}
Seems to automatically go to the last anchor on the page (whatever it is)
Redirecting is not envisioned as a use case for mkdocs-gen-files. I was surprised to see it used as such and assumed to be working well.
I believe you got this example from https://github.com/mkdocstrings/mkdocstrings/blob/e19071b5cab120721ac898da8a87ca97dff23aa3/docs/gen_redirects.py -I don't think this example is advertised anywhere.
In your latter example, this value "reference/glossary/#test-1"
is directly passed to open(page, 'w')
, so of course it will create a file named as such. I don't think within mkdocs-gen-files it is reasonable to pursue anything that would satisfy this use case.
For more proper redirects I would recommend this plugin https://github.com/datarobot/mkdocs-redirects It doesn't work there either but at least this feature request could be reasonable there.
The reply you got here is also very insightful: https://github.com/squidfunk/mkdocs-material/discussions/3764#discussioncomment-2429473
Ironically, I got here from that other plugin, due to the recommendation on this issue: https://github.com/datarobot/mkdocs-redirects/issues/16
Hopefully you take over the plugin and add # support. In the mean time . . . well, thanks for answering!
Hi! I am trying to use this plugin for client side redirects with '#' in. I've got the basics working:
However, it doesn't work if the redirect is from an anchor tag:
It generates a page:
glossary/#test-1
(I guess as intended) Is there a way to handle # in the original link?Thanks for any help!