Page MenuHomePhabricator

Wikidata identifier links don't respect nofollow configuration
Closed, ResolvedPublic

Description

On a page like https://www.wikidata.org/wiki/Q190434 (with JavaScript enabled) I see

<a rel="nofollow" class="external free" href="http://moodle.org">http://moodle.org</a>

but also:

<a class="wb-external-id" href="https://www.quora.com/topic/Moodle">Moodle</a>

The identifier link with URL formatting is treated like an internal link, which is clearly wrong. The wb-external-id class should style the link as an external link.

Additionally, when $wgNoFollowLinks = true, one would expect all such external links to be nofollow'ed unless whitelisted (e.g. by means of $wgNoFollowDomainExceptions).

If there is a desire to have an on-wiki per-domain whitelisting, similar to the interwiki map, this should be controllable together with the URL formatting (P1630). I'm not sure where the URL-generation code resides though; I think it used to be a gadget.

Details

Related Gerrit Patches:

Event Timeline

Nemo_bis created this task.Sep 7 2017, 5:54 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 7 2017, 5:54 AM

This is still happening.

Quora links to us with do-follow and we link to them with do-follow. In this case, I don't see a problem.

revi added a subscriber: revi.Nov 5 2017, 5:31 PM
thiemowmde triaged this task as Normal priority.Nov 13 2017, 10:53 AM
thiemowmde moved this task from incoming to ready to go on the Wikidata board.

Analysis:

  • HtmlUrlFormatter currently hard-codes rel="nofollow" as well as class="external free".
  • "nofollow" as well as "external" are required for the reasons explained above.
  • The "free" specifies the link type further and should be set if "link text equals URL", see https://phabricator.wikimedia.org/source/mediawiki/browse/master/includes/parser/Parser.php;1b13888ed6bd09731f10045650714a3392bb55df$1862. This is true for the URL data type, but not for external identifiers.
  • HtmlExternalIdentifierFormatter misses all this.
  • A quick fix should be to add rel="nofollow" as well as class="external" to HtmlExternalIdentifierFormatter.
  • A better solution might be to utilize MediaWiki core's Linker::makeExternalLink in both formatters.

Change 497067 had a related patch set uploaded (by Lucas Werkmeister; owner: Lucas Werkmeister):
[mediawiki/extensions/Wikibase@master] Add class=external and rel=nofollow external identifier links

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

Change 497067 had a related patch set uploaded (by Lucas Werkmeister; owner: Lucas Werkmeister):
[mediawiki/extensions/Wikibase@master] Add class=external and rel=nofollow external identifier links

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

Change 497067 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Add class=external and rel=nofollow external identifier links

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