DOC: Redirect old whatsnew links
See original GitHub issueIn https://github.com/pandas-dev/pandas/pull/21599 we’re chagning the structure of our whatsnew. Previously the whatsnew for each version was concatenated into a single large file.
Consider a link to the anchor #whatsnew-0190-enhancements-other
. There are three cases:
- Version-specific URLs like http://pandas.pydata.org/pandas-docs/version/0.23.0/whatsnew.html#whatsnew-0190-enhancements-other will continue to work. We don’t have to change anything.
- People linking via
/stable
(which is probably more common), or to version 0.24.0 or higher will break. http://pandas.pydata.org/pandas-docs/stable/whatsnew.html#whatsnew-0190-enhancements-other won’t be a valid reference. We would need to rewrite it to http://pandas.pydata.org/pandas-docs/stable/releases/#whatsnew-0190-enhancements-other
We use nginx for our webserver at pandas.pydata.org. But AFAICT, we can’t use a rewrite rule to redirect this links, since nginx doesn’t see the anchor.
We should be able to detect this in Javascript. When we’re on the whatsnew for 0.24.0 or greater, we want to look for anchors pointing to /whatsnew.html#whatsnew-<version>
for 0.23.4 or older. Then we’d rewrite /whatsnew.html#whatsnew-<version>-<title>
to /whatsnew/<version>.html#<title>
. So a test case is
before: http://pandas.pydata.org/pandas-docs/stable/whatsnew.html#whatsnew-0190-enhancements-other
after: http://pandas.pydata.org/pandas-docs/stable/whatsnew/v0.19.0.html#other-enhancements
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Redirects and Google Search | Documentation
Redirecting URLs is the practice of resolving an existing URL to a ... sure that links to outdated URLs are redirected to the...
Read more >Redirects: Different types and how to implement them - Moz
A redirect is a way to send both users and search engines to a different URL from the one they originally requested. The...
Read more >Create and Manage Docs Redirects - Help Scout Support
A redirect is a way to send both customers and search engines to a different URL from the one they originally requested.
Read more >Redirects in GitLab documentation
The links in the global navigation are already tested in the gitlab-docs project. ... Add the redirect code to the old documentation file...
Read more >How to create absolute hyperlinks and relative hyperlinks in ...
These hyperlinks can be absolute. Or, these hyperlinks can be relative to the Word document that you are working with. By default, the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for this! A redirect map with a hook for parsing uri fragments could be a useful addition to Sphinx, as well.
You can add custom JavaScript to Sphinx templates with
add_js_file()
(was:add_javascript()
) inconf.py
.https://www.sphinx-doc.org/en/master/extdev/appapi.html#sphinx.application.Sphinx.add_js_file
https://docs.readthedocs.io/en/latest/guides/adding-custom-css.html#adding-custom-css-or-javascript-to-a-sphinx-project
Just merged it into master, so you you merge that then you’re good to go.
FYI, the doc build will be live in ~1 hour, whenever https://travis-ci.org/pandas-dev/pandas/jobs/455198927 finishes. Those will be uploaded to http://pandas-docs.github.io/pandas-docs-travis/ (you don’t have to worry about redirecting anything on that domain)