-
Notifications
You must be signed in to change notification settings - Fork 29
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
Option to override use_directory_urls for redirect sources #59
Comments
I'm looking for almost the same thing. It would probably end up being covered by the same update to mkdocs-redirects. I have a legacy site with file-style URLs, because we used to deliver the docs with our SDK as well as online. Now our docs are online-only and we want to set |
Possible workaround: plugins:
- redirects:
redirect_maps:
old/url.html.md: new/page.md What's fun is that it will create a directory URL named I have successfully used this technique for my blog in the past 🙂 plugins:
- search
- redirects:
redirect_maps:
2018/02/01/docker-compose-django-postgres-nginx.html.md: posts/docker-compose-django-postgres-nginx.md
2017/05/31/python-static-code-analysis-tools.html.md: posts/python-static-code-analysis-tools.md
2016/12/07/documentation-in-your-shell-scripts-using-shellman.html.md: posts/documentation-in-your-shell-scripts-using-shellman.md
2016/12/07/write-and-use-a-tox-plugin-from-inside-your-package.html.md: posts/write-and-use-a-tox-plugin-from-inside-your-package.md
2016/04/06/django-dashboard-with-suit-and-highcharts.html.md: posts/django-dashboard-with-suit-and-highcharts.md |
That's a really interesting proposition. I'll have to try it. So far everything I've tried has ended up with an infinite redirect loop because the directory structure isn't changing, just that one |
It works! Now as long as that workaround isn't a bug that gets 'fixed'... |
For what it's worth, the 'right' way to do what I was doing is to write a server-side redirect for that URL pattern. And that is exactly what my colleague just did because I hadn't told him I was pursuing it from the docs config side, so we're going with that solution since he's already done it. But this workaround did work! Thank you for it! |
I'd be happy to confirm that this behavior is not a bug and therefore will not be "fixed", but I'm just a passing-by maintainer 🙂 I'll close anyway! If the original authors, other maintainers, or impacted users disagree, we'll reopen. |
Now mkdocs-redirect create both source and target redirect URLs based on mkdocs option use_directory_urls
But if we had a legacy site with file-style URLs and now we need redirects from that old legacy to new shiny site with fancy URL redirects we are out of luck :(
So I end with that hack:
https://github.com/andgineer/TRegExpr/blob/master/docs/fix_folder_redirects.py
To fix that for example we can have mkdocs-redict option use different use_directory_urls for the redirect sources.
Also we could specify that for each redirect.
The text was updated successfully, but these errors were encountered: