Page MenuHomePhabricator

Provide class name for links to disambiguation pages
Closed, ResolvedPublic

Description

Author: dunc_harris

Description:
I'm not sure this can be done without fixing T8754 first, but...

Links to disambiguation pages are (mostly) bad. The only way to find out whether a page one is linking to is a disambiguation page is by going there, and perhaps remembering for the future, unless it's obvious like [[tree (disambiguation)]] or something.

The obvious colour is green, though how this will sit with those who have [[colour blindness]], I don't know (though they seem to manage ok with [[traffic lights]])


Version: unspecified
Severity: enhancement

Details

Reference
bz8339

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 9:29 PM
bzimport set Reference to bz8339.

robchur wrote:

We said no to this for links to redirects, didn't we?

rotemliss wrote:

Links to disambiguation pages shouldn't be exist: use
[[Special:Disambiguations]] to clean them up.

ayg wrote:

(In reply to comment #1)

We said no to this for links to redirects, didn't we?

Because redirect links are supposed to be functionally identical to any links to
the target page. Not really applicable. We already have (optionally) a
different color for pages below a specified length.

speedbump0619 wrote:

Most links to disambiguation pages are created unintentionally. If, when editing a page, links to disambiguation pages were a different color (probably the same as/similar to non-existant pages) editors would immediately be able to tell they needed to alter their link during previews.

A side effect of implementing this behavior: there should be a method for explicitly linking to the disambiguation page, without the different color, in the rare circumstance where that is the author's intent.

This is gonna be expensive to implement. Rather than just checking whether a page exists, we'd need to check whether it transcludes Template:Disambig, which is significantly more trouble when checking hundreds of pages at a time.

robchur wrote:

(In reply to comment #5)

This is gonna be expensive to implement.

This is distinctly why bug 6754 is marked as a dependency.

ayg wrote:

(In reply to comment #5)

This is gonna be expensive to implement. Rather than just checking whether a
page exists, we'd need to check whether it transcludes Template:Disambig, which
is significantly more trouble when checking hundreds of pages at a time.

Is it? I tried a slightly modified version of the query from Special:Allpages, as a simple case. Compare:

mysql> EXPLAIN SELECT page_namespace,page_title,page_is_redirect FROM page FORCE INDEX (name_title) WHERE page_namespace = '0' AND (page_title >= 'Closed') ORDER BY page_title LIMIT 10;
+----+-------------+-------+------+---------------+------------+---------+-------+--------+-------------+

idselect_typetabletypepossible_keyskeykey_lenrefrowsExtra

+----+-------------+-------+------+---------------+------------+---------+-------+--------+-------------+

1SIMPLEpagerefname_titlename_title4const585538Using where

+----+-------------+-------+------+---------------+------------+---------+-------+--------+-------------+
1 row in set (0.01 sec)

mysql> SELECT page_namespace,page_title,page_is_redirect FROM page FORCE INDEX (name_title) WHERE page_namespace = '0' AND (page_title >= 'Closed') ORDER BY page_title LIMIT 10;
+----------------+---------------------------+------------------+

page_namespacepage_titlepage_is_redirect

+----------------+---------------------------+------------------+

0Closed0
0Closed-Circuit_Television1
0Closed-Cone_Pine_Forest1
0Closed-End_Fund1
0Closed-_loop1
0Closed-angle_glaucoma1
0Closed-apple_key1
0Closed-bolt1
0Closed-caption1
0Closed-caption_television1

+----------------+---------------------------+------------------+
10 rows in set (5.09 sec)

Versus the query with disambig:

mysql> EXPLAIN SELECT page_namespace,page_title,page_is_redirect,COUNT(tl_from) != 0 AS disambig FROM page FORCE INDEX (name_title) LEFT JOIN templatelinks FORCE INDEX (tl_from) ON page_id=tl_from AND tl_namespace=10 AND tl_title IN ('Bio-dab', 'Dab', 'Diasmbig', 'Disamb', 'Disamb-cleanup', 'Disambig', 'Disambig-cleanup', 'Disambiguation', 'Geodis', 'Hndis', 'Hndisambig', 'Numberdis', 'Roaddis', 'Surname') WHERE page_namespace = '0' AND (page_title >= 'Closed') GROUP BY page_title ORDER BY page_title LIMIT 10;
+----+-------------+---------------+------+----------------------+------------+---------+---------------------------+--------+-------------+

idselect_typetabletypepossible_keyskeykey_lenrefrowsExtra

+----+-------------+---------------+------+----------------------+------------+---------+---------------------------+--------+-------------+

1SIMPLEpagerefname_titlename_title4const585543Using where
1SIMPLEtemplatelinksreftl_from,tl_namespacetl_from8enwiki.page.page_id,const3Using index

+----+-------------+---------------+------+----------------------+------------+---------+---------------------------+--------+-------------+
2 rows in set (0.02 sec)

mysql> SELECT page_namespace,page_title,page_is_redirect,COUNT(tl_from) != 0 AS disambig FROM page FORCE INDEX (name_title) LEFT JOIN templatelinks FORCE INDEX (tl_from) ON page_id=tl_from AND tl_namespace=10 AND tl_title IN ('Bio-dab', 'Dab', 'Diasmbig', 'Disamb', 'Disamb-cleanup', 'Disambig', 'Disambig-cleanup', 'Disambiguation', 'Geodis', 'Hndis', 'Hndisambig', 'Numberdis', 'Roaddis', 'Surname') WHERE page_namespace = '0' AND (page_title >= 'Closed') GROUP BY page_title ORDER BY page_title LIMIT 10;
+----------------+---------------------------+------------------+----------+

page_namespacepage_titlepage_is_redirectdisambig

+----------------+---------------------------+------------------+----------+

0Closed01
0Closed-Circuit_Television10
0Closed-Cone_Pine_Forest10
0Closed-End_Fund10
0Closed-_loop10
0Closed-angle_glaucoma10
0Closed-apple_key10
0Closed-bolt10
0Closed-caption10
0Closed-caption_television10

+----------------+---------------------------+------------------+----------+
10 rows in set (5.10 sec)

Note: This is on the toolserver and so is crazy slow, the real query should be a few milliseconds in either case, but the point is there's no real difference. Anyway, this is just an example, it could be easily adapted to LinkBatch or whatnot.

  • Bug 11902 has been marked as a duplicate of this bug. ***

A CSS class can be added now with the Disambiguator extension hooking into 'LinkEnd'

Change 82604 had a related patch set uploaded by Raimond Spekking:
Add a CSS class to disambiguation pages

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

Change 100115 had a related patch set uploaded by Kaldari:
Conditionally add a CSS class to disambiguation pages

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

Change 82604 abandoned by Raimond Spekking:
Add a CSS class to disambiguation pages

Reason:
In favour of Kaldari's change Id511fd84 for an alternative implementation. Thank you!

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

Change 100115 abandoned by Kaldari:
Conditionally add a CSS class to disambiguation pages

Reason:
Per MaxSem

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

Change 157836 had a related patch set uploaded by Bartosz Dziewoński:
Add 'mw-disambig' CSS class to disambiguation pages

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

Once more, with feeling. This time the solution should be performant :)

Change 157836 merged by jenkins-bot:
Add 'mw-disambig' CSS class to disambiguation pages

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