Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Existing .html Redirect #18

Open
adam-stamand opened this issue Dec 8, 2020 · 3 comments
Open

Existing .html Redirect #18

adam-stamand opened this issue Dec 8, 2020 · 3 comments

Comments

@adam-stamand
Copy link

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?

@adam-stamand
Copy link
Author

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.

@JC5
Copy link

JC5 commented Jan 10, 2021

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.

@prcr
Copy link
Contributor

prcr commented Apr 23, 2021

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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants