question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DOC: Redirect old whatsnew links

See original GitHub issue

In 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:

  1. 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.
  2. 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:open
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
westurnercommented, Nov 15, 2018

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()) in conf.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

1reaction
TomAugspurgercommented, Nov 14, 2018

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)

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found