mkdocs-redirects
mkdocs-redirects copied to clipboard
Existing .html Redirect
Is there a way to redirect to an existing .html file? I previously used the now deprecated redirect:
in the .md file to redirect to an .html that was already generated using other software. From what I can tell, this plugin only allows you to specify .md files, which effectively would prevent me from using raw .html redirect.
For example, if I have an .html file called /docs/content/page.html and I want an index.html generated by mkdocs to redirect to it, I previously just put redirect: page.html
in /docs/content.md, and I would automatically be redirected to page.html when I navigated to the /docs/content page.
Is there any way to achieve this effect with the mkdocs-redirects plugin?
Note that one workaround is to place <meta http-equiv="refresh" content="0; URL=page.html" />
inside the .md file for redirection. This solution doesn't require the plugin at all, though I'm still curious if the plugin supports this pattern.
I am also curious about this. I have several old pages in this format: /en/latest/installation/docker.html
.
It is impossible to create a redirect for those.
Besides *.md
files, mkdocs-redirects also allows you to redirect to full URLs. So a quick workaround would be to do redirects like in this example:
plugins:
- redirects:
redirect_maps:
"content.md": "https://example.com/content/page.html"
"en/latest/installation.md": "https://example.com/en/latest/installation/docker.html"