Last modified: 2014-11-17 10:36:48 UTC
I'm not sure this can be done without fixing http://bugzilla.wikipedia.org/show_bug.cgi?id=6754 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]])
We said no to this for links to redirects, didn't we?
Links to disambiguation pages shouldn't be exist: use [[Special:Disambiguations]] to clean them up.
(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.
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.
(In reply to comment #5) > This is gonna be expensive to implement. This is distinctly why bug 6754 is marked as a dependency.
(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; +----+-------------+-------+------+---------------+------------+---------+-------+--------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+-------+------+---------------+------------+---------+-------+--------+-------------+ | 1 | SIMPLE | page | ref | name_title | name_title | 4 | const | 585538 | Using 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_namespace | page_title | page_is_redirect | +----------------+---------------------------+------------------+ | 0 | Closed | 0 | | 0 | Closed-Circuit_Television | 1 | | 0 | Closed-Cone_Pine_Forest | 1 | | 0 | Closed-End_Fund | 1 | | 0 | Closed-_loop | 1 | | 0 | Closed-angle_glaucoma | 1 | | 0 | Closed-apple_key | 1 | | 0 | Closed-bolt | 1 | | 0 | Closed-caption | 1 | | 0 | Closed-caption_television | 1 | +----------------+---------------------------+------------------+ 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; +----+-------------+---------------+------+----------------------+------------+---------+---------------------------+--------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+---------------+------+----------------------+------------+---------+---------------------------+--------+-------------+ | 1 | SIMPLE | page | ref | name_title | name_title | 4 | const | 585543 | Using where | | 1 | SIMPLE | templatelinks | ref | tl_from,tl_namespace | tl_from | 8 | enwiki.page.page_id,const | 3 | Using 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_namespace | page_title | page_is_redirect | disambig | +----------------+---------------------------+------------------+----------+ | 0 | Closed | 0 | 1 | | 0 | Closed-Circuit_Television | 1 | 0 | | 0 | Closed-Cone_Pine_Forest | 1 | 0 | | 0 | Closed-End_Fund | 1 | 0 | | 0 | Closed-_loop | 1 | 0 | | 0 | Closed-angle_glaucoma | 1 | 0 | | 0 | Closed-apple_key | 1 | 0 | | 0 | Closed-bolt | 1 | 0 | | 0 | Closed-caption | 1 | 0 | | 0 | Closed-caption_television | 1 | 0 | +----------------+---------------------------+------------------+----------+ 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
Yay.