-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Doc implement reredirects #19456
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
Doc implement reredirects #19456
Conversation
74331a4
to
abeef9d
Compare
The placeholders cause the build to fail:
|
Yep. Those can be orphaned. Looks like the links need to be relative to the directory that they are being made in as well (despite what the docs say). Making them absolute to root probably works too, but doesn't work in the artifacts html... |
Well, that works. I'm not a huge fan to be honest, and almost wish we could just have a new sphinx directive. Is that easy? |
To see how this work, navigate to https://53094-1385122-gh.circle-artifacts.com/0/doc/build/html/api/backend_gtk3agg_api.html and it will take you to |
I'll have a look at the directive possibility. |
Cool, it should be pretty straightforward. I may look at it as well, but probably a bit of learning curve. For reference, all the reredirects does is change the html to: <html><head><meta http-equiv="refresh" content="0; url=${to_uri}"></head></html> It might be nice to spice that up a bit (add a canonical?) but I think even as-is search engines will recognize that this is not supposed to be indexed. |
@jklymak See https://github.com/anntzer/sphinx-redirectfrom (quick hack, barely tested, unlikely to eat your dog though). I went for what I think is a slightly nicer approach of not actually requiring to keep the old files in the source tree and having a |
Nice, I think I agree thats better, because if we delete the new target, it would be nice to know we have to redirect again. I'll play with that over the w/e. Thanks a lot! |
8087a9d
to
3af306c
Compare
As an example from the build above:
So now if you navigate to: https://53162-1385122-gh.circle-artifacts.com/0/doc/build/html/api/backend_qt4agg_api.html you are immediately redirected to: https://53162-1385122-gh.circle-artifacts.com/0/doc/build/html/api/backend_qt_api.html |
beec731
to
9289f61
Compare
I guess you could support both |
9289f61
to
4a205db
Compare
Sure, well we could cross that bridge when we come to it. For now we have a pretty easy way to redirect if we move, so I think this can wait. |
In the meeting, or is it okay to merge now? |
This is fine from my end. I think folks have had lots of time to voice concerns. Plus its not an irrevocable change if we decide this is a bad way to go. |
@timhoffm @story645 @dstansby @brunobeltran This make sense to all of you? |
Need to add warning for an overwrite.... |
7049b88
to
cf7f0bb
Compare
ENH: add redirect_from sphinx extension Co-authored-by: Antony Lee <anntzer.lee@gmail.com> Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
cf7f0bb
to
7e4a922
Compare
a00a2bf
to
58f495a
Compare
58f495a
to
47145d1
Compare
.. added a redirect from |
Did we mean to take out |
Ooops! No, I mean we could ;-) It crashes on my machine when I do the doc build. |
Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
I think this is still in good shape? I wouldn't mind it being merged so we can start doing more manual redirects |
…456-on-v3.4.x Backport PR #19456 on branch v3.4.x (Doc implement reredirects)
PR Summary
UPDATE:
This is based off #19440 just because that is a good example where some existing files were deleted.
This now uses a vendored version https://github.com/anntzer/sphinx-redirectfrom @anntzer put together. In #19440
doc/api/backend_qt4agg_api.rst
was removed, and the info is now indoc/api/backend_qt_api.rst
sodoc/api/backend_qt4agg_api.rst
now has aredirect-from
directive:When the build is made this makes
build/html/backend_qt4agg_api.html
which has a refresh:so the old link still exists.
(probably not super necessary for this example, but in general should be quite useful).
I think there are in general some major disadvantages compared with the
reredirect
approach. Namely that moving whole directories will require each file in the directory getting this directive to its new location. OTOH, that is pretty easy to script up if someone needs to do a bulk move.PR Checklist
pytest
passes).flake8
on changed files to check).flake8-docstrings
and runflake8 --docstring-convention=all
).doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).