Page MenuHomePhabricator

Recursive interwiki link handling should be possible
Open, LowPublicFeature

Description

Sometimes interwiki links like [[Wikipedia:fr:France]] are used.

This could be problematic when we start outputting hreflang on interwiki links.
[[Wikipedia:fr:France]] would end up with a hreflang="en" instead of the correct hreflang="fr".

Additionally it would be much nicer to have direct hrefs. Besides looking saner when the user hovers over the link it would also play much nicer with the browser's :visited handling.

And it's not that unreasonable for someone to suggest "We should have a sitename in the title/tooltip". In which case [[Wikipedia:fr:France]] becomes "fr:France - Wikipedia" instead of the "France - Wikipédia" that we want.


Basically this means that after we've parsed out our interwiki we should consider parsing out interwikis that other wikis use.

I manage to come up with an idea how this could be done for non-local wikis.

We handle this in multiple passes.

  • The first time we see [[Wikipedia:fr:France]] when parsing an article we end up outputting it the same way we do now as (Wikipedia, fr:France)
  • Because an interwiki for a site we don't know any information about was used a job is queued after parsing
  • In the job we do an API fetch to the other wiki to get site info and the wiki's local interwiki map and we store this info
  • After this info is fetched we do refreshlinks jobs on the page(s) where interwiki links to this wiki was used
  • This second time around when parsing now that we've stored the interwiki map we parse [[Wikipedia:fr:France]] as (Wikipedia:fr, France) now that we know that Wikipedia: has a fr: inside of it's local interwiki map.

This is the way it would work for remote wikis. We might do the code for this a little more abstractly. So that local cases that only require a sql lookup can be handled. And so that cases like Wikia's custom [[w:c:foo:Bar]] can also be handled by them implementing some extra code.


Version: unspecified
Severity: enhancement

Details

Reference
bz39199

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 1:07 AM
bzimport set Reference to bz39199.
bzimport added a subscriber: Unknown Object (MLST).
Aklapper changed the subtype of this task from "Task" to "Feature Request".Feb 4 2022, 11:14 AM