-
Notifications
You must be signed in to change notification settings - Fork 28
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
Allow to use regular expressions for redirects #29
Comments
What I personally would like is support for wildcard patterns, to allow redirects of entire sections, similar to what Cloudflare allows in their redirect rules. The common use-case is when you renamed an entire section from one name to another, resulting in X files having a new location. You would now need to set like X links, or make a redirect with the wildcard that would allow to change all pages with a single redirect. Example-setup: plugins:
- redirects:
redirect_maps:
'old/*': 'new/$1' # The $1 would be the first wildcard in the path The above would now allow If such a feature is already available should it be mentioned in the readme. |
We use this plugin for our website https://knative.dev and would like to see this feature From one of our contributors:
|
Also be interested in this. |
+1 for our docs at https://docs.ultralytics.com |
This is impossible to implement. In order to redirect Although if we think about it in the opposite direction-- For every page |
What about use of js? I think this could work for dynamic redirects? |
Couldn't we use a script on the EDIT: to prevent this impacting SEO, we might need to ensure the HTTP status does not return 404 for pages which we have a redirect for. EDIT 2: this will clearly only work for paths that do not have corresponding markdown pages (because those paths would never hit 404), but we can just warn people in the docs about that. |
Issue I see here is hosts that don't use the 404 page. |
Yeah, I was just investigating on the GitHub actions side (which is probably the vast majority of public MkDocs websites), and it works by just serving the I am not clear if client-side redirects on 404 pages are respected in the same way as 30X codes (for Google's SEO purposes), but it's probably the best option we have to allow complex, regex-based redirects. |
Looking into it more, it seems like even the existing Currently, we are avoiding the "duplicate content" issue by setting the EDIT: I have found this reference page from Google about how it treats various kinds of redirects, it says that Google will treat javascript
|
Right now it only allows a 1-1 correspondance. Sometimes when migrating documentation you may find yourself that externally referenced links may be broken.
If this plugin allows you to select regular expressions, it removes the need of any external redirection, such as one you could do by yourself with nginx.
The text was updated successfully, but these errors were encountered: