Page MenuHomePhabricator

Redirect existing hyperlinks to old docs
Closed, ResolvedPublic

Description

We got feedback that a user had a bookmark to https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.Message that has now become a dead link .

It seems we could add some JavaScript to handle links in this form to ease migration.

TODO

Event Timeline

https://www.mediawiki.org/wiki/Template:Js_doclink creates links of the above format, so it'd be good to have those working again (although I'm sure that template will be updated with the new URL structure once the new docs are all sorted out).

I think this needs to be done in the JSDoc theme... some kind of code snippet that checks the hash fragment and does a redirect on the client.

Change 982937 had a related patch set uploaded (by Eric Gardner; author: Eric Gardner):

[jsdoc/wmf-theme@master] js: Add redirect.js

https://gerrit.wikimedia.org/r/982937

Change 982937 merged by jenkins-bot:

[jsdoc/wmf-theme@master] js: Add redirect.js

https://gerrit.wikimedia.org/r/982937

I can't submit a patch to jsdoc/wmf-theme (Permission denied), so I made a PR to GitHub, do what you want with it: https://github.com/wikimedia/jsdoc-wmf-theme/pull/4.

I can't submit a patch to jsdoc/wmf-theme (Permission denied),

Hmm, that is annoying. I have created T364361: Configure jsdoc/wmf-theme repo permissions

@Jack_who_built_the_house sorry about that - I've added you to that repo so you should be able to push patches now. Thanks for working on this!

Change #1028849 had a related patch set uploaded (by Jack who built the house; author: Jack who built the house):

[jsdoc/wmf-theme@master] js: Fix redirecting for links to methods and properties

https://gerrit.wikimedia.org/r/1028849

Change #1028849 merged by jenkins-bot:

[jsdoc/wmf-theme@master] js: Fix redirecting for links to methods, properties, and events

https://gerrit.wikimedia.org/r/1028849

New patch released as part of v1.0.1 Edit: Mistake

Change #1028849 had a related patch set uploaded (by Jack who built the house; author: Jack who built the house):

[jsdoc/wmf-theme@master] js: Fix redirecting for links to methods and properties

https://gerrit.wikimedia.org/r/1028849

Definitely missing. I just tried "see documentation" on [[mw.OOUI/Windows/Simple messages]], and get 404. Finally get from somebody a right address, and documenfation is missing too, but that's another story, not for this task.

Latest patch released in v1.1.0. Let's leave this open and see if the issues identified in recent comments have been fixed

Not all methods seem to redirect properly. For example, the redirect for https://doc.wikimedia.org/oojs/master/#!/api/OO-method-inheritClass doesn't have the necessary dot in front.

Not all methods seem to redirect properly. For example, the redirect for https://doc.wikimedia.org/oojs/master/#!/api/OO-method-inheritClass doesn't have the necessary dot in front.

Having 100% of URLs redirect properly was not the goal; there is no simple pattern for the matches and approximating it wouldn't be worth the effort. As for OO methods, I used the capital letter as a heuristic to tell classes (that generally have instances, like mw.Uri) from namespaces (that generally have members, like mw, mw.util). OO would be a special case here as a namespace starting with a capital letter. But I think OO methods have been using JSDuck for a long time? Is a redirect really needed here?

Well, Bing still has the old links. I thought that meant other search engines will also do the old links but that seems false and I agree that it's probably not worth the extra effort.