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.

Event Timeline

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

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