Skip to content
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

Use sphinx-reredirects for renaming/removed documentation #11837

Open
embray opened this issue Jun 14, 2021 · 1 comment
Open

Use sphinx-reredirects for renaming/removed documentation #11837

embray opened this issue Jun 14, 2021 · 1 comment

Comments

@embray
Copy link
Member

embray commented Jun 14, 2021

Description

The sphinx-reredirects Sphinx extension would be useful for declaring redirected pages directly in our conf.py when pages get renamed or removed, as opposed to having to set up the redirects manually in RTD (in addition to keeping such redirects under VC which is not currently possible with RTD redirects, it would also work for non-RTD builds of the docs).

Additional context

We've had a few cases where moving or renaming docs have broken things like search results, or in some cases other packages' documentation that links to the Astropy docs (see e.g. #11754). Currently, any time we move documentation around we must also take care to set up redirects in RTD, which can only be done by someone with access to the RTD project. It's easy to miss.

By using a Sphinx extension for this, we can include such redirects in any PR that requires documentation moves.

I've seen some other extensions for this, but this one is quite recent, actively maintained, and seems like one of the simplest to use and quite flexible.

@astrofrog asked

Could we actually replace the redirects configured on RTD with this? The redirects on RTD currently are ‘top level’ in the sense we can add urls at the level of latest/stable/etc - this would only be useful within a set of docs right?

It's a good question and I'm not 100% sure it could replace all use cases for RTD's redirects. But it would be useful in many caes--for example, I wanted to use this for #11367 which requires an old doc page that I want to remove to be replaced with a redirect to a different doc page.

It also could have been used for the redirect of all developer doc pages to the "latest" docs (which prompted #11754) like:

redirects = {
    'development/*': 'https://docs.astropy.org/en/latest/$source.html'
}

The redirect could also be made contingent on whether or not the docs are being built for RTD.

@embray embray added Docs Effort-low Affects-dev PRs and issues that do not impact an existing Astropy release Package-intermediate labels Jun 14, 2021
@pllim pllim removed the Affects-dev PRs and issues that do not impact an existing Astropy release label Jun 14, 2021
@pllim
Copy link
Member

pllim commented Jun 14, 2021

FYI -- I removed "Affects-dev" label because it means nothing without a milestone and we don't milestone issues unless they block the release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants