-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Create redirects automatically on file renames #6621
Comments
I think this should not be something we build into the platform, but a tool we create for users as a CLI app, that would create redirects against the API. Even better, it could just output the YAML format for our fancy YAML-based redirects that we'll build :) |
My idea behind implementing this under RTD is that you can forget about this and leave RTD to handle it for you. Otherwise, each time you rename a file you have to remember to update these redirects to match the current state. So, I'm trying to think in a way where the detection of file changes can either:
I'm not convinced what's the best implementation for this, but whatever it be, I'd love to make the feature let me know about redirects changes instead of myself telling the platform that I changed something. |
Currently we're developing an extension that solves this We have this setup as a CI check to determine when a git rename occurs, and then it fails CI if it detects. The contributor then has to add the redirect themselves, or run our autoredirect sphinx builder which adds all 100% prediction redirects to the redirects file. So it's not fully automatic, but we've determined it to be pretty good. |
Just released a stable release of the extension which includes a builder for CI checking redirect.
|
I had an idea, not related to automatically create redirects, but more related to detect broken pages, so users can take action on that. We have files in storage, we can use that to compare all files that are missing from a version with another, for example, compare the files from v2 and v3 version. Or even do the comparison on build time, we have the files on the local system, and we can compare the files that are deleted (maybe rclone could provide that information even, maybe in the output, bc didn't find any option for it). Not sure where we could show that information, though. |
It would be awesome if Read the Docs could detect that a file was renamed and automatically creates a redirect for this file, so the URLs for the old resource keeps working.
I did a small research about how to get this data from
git
and I found that it's possible to detect delete/add par files as a rename if more than X percentage of the file hasn't changed.In the following example, the command shows only those files that haven't change more than 70%. Taking a look at the output, seems accurate to what we have done with our docs.
With this data, we could detect which of these files are under a documentation path (defined in config file) and match the documentation type (rst, md) and create a redirect with this data. Example, from
docs/yaml-config.rst
todocs/config-file/v1.rst
.We need to consider what type of builder the documentation uses (e.g.
dirhtml
) and build the URL accordingly.Related to #4221
The text was updated successfully, but these errors were encountered: