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

Allow to specify redirects in _pkgdown.yml #1259

Closed
lorenzwalthert opened this issue Mar 21, 2020 · 5 comments · Fixed by #1639
Closed

Allow to specify redirects in _pkgdown.yml #1259

lorenzwalthert opened this issue Mar 21, 2020 · 5 comments · Fixed by #1639
Assignees
Labels
feature a feature request or enhancement front end 🌷 General HTML, CSS, and JS issues

Comments

@lorenzwalthert
Copy link
Contributor

Assuming I have a vignette that I rename, the pkgdown link to this vignette will change and all people who follow the old link will see a 404 error. The same with help files for renamed functions etc. It would be nice if {pkgdown} could provide a way to specify redirects manually, relative to the base url, e.g. in _pkgdown.yml:

redirects:
  articles/new-vignette-name.html:
  - articles/old-vignette-name.html
  - articles/another-old-vignette-name.html

Looks like this is valid yml. The key should be the new name, because it's potentially a one-to-many mapping. What do you think of such a feature?

@lorenzwalthert lorenzwalthert changed the title Allow to specify redirects manually Allow to specify redirects in _pkgdown.yml Mar 21, 2020
@hadley
Copy link
Member

hadley commented Mar 21, 2020

Yeah, I like it — we'd have to do html style redirects, but that would be better than nothing.

@jayhesselberth
Copy link
Collaborator

You can make a custom 404.md file to catch 404 errors so that users get sent somewhere useful.

pkgdown has a generic one: https://pkgdown.r-lib.org/dev/outdated-vignette-name.html

@lorenzwalthert
Copy link
Contributor Author

lorenzwalthert commented Mar 21, 2020

According to StackOverflow, "Use of meta refresh is discouraged by the World Wide Web Consortium", which seems to be used by the html style redirects, so I think it's better to look for another solution?

@hadley
Copy link
Member

hadley commented Mar 21, 2020

There is no other solution; an html style redirect is the best we can hope for in pkgdown, given that the most common form of deployment is github pages which doesn't support redirects at the http level.

@Bisaloo
Copy link
Contributor

Bisaloo commented Mar 21, 2020

Another option would be for pkgdown to create a page that mirrors the content of the new vignette URL but on the old URL, possibly with a deprecation warning:

It looks like you found this page by following a deprecated link. Please save the new link to this vignette: new link.

But this would possibly add a lot of complexity to an already complex package.

@hadley hadley added feature a feature request or enhancement front end 🌷 General HTML, CSS, and JS issues labels Apr 6, 2020
@maelle maelle self-assigned this Apr 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement front end 🌷 General HTML, CSS, and JS issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants