User:Certes/sandbox

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Certes (talk | contribs) at 19:15, 2 February 2019 (copyedit). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Disambiguating links made by templates

Some templates generate wikilinks from their parameters in a way which works in most cases but requires special care for qualified titles. This page details some techniques which can be used to fix incorrectly generated links, especially those which lead to disambiguation pages.

Countries

{{Infobox country}} links to related articles in a consistent but complicated way. The resulting title is not always occupied by the desired article, especially when multiple countries share a common name such as "Virgin Islands".

For national flags and symbols, the target can be overridden with |flag_type_article= and |symbol_type_article=. Example fix: British Virgin Islands. The "Government" link can be changed with |politics_link=. That subtitle cannot easily be unlinked. If there is no relevant article than one option is a harmless target such as Government. Example fix: Provisional Government of the Republic of Korea.

Infobox country is also used via several redirects such as Infobox former country.

Languages

Several templates assumes that X language is an article about, or a redirect to, the language named X. This assumption is generally true, and Module:Lang/data now handles the sole exception: Ligurian. It is coded flexibly so that other exceptions can be added by a template editor. Some templates accept an ISO 639 code rather than a name, e.g. lij for Ligurian.

Railway stations

Railway station templates deal well with disambiguation. Although they make assumptions about the exact format of article titles, those assumptions are generally true, or at least there is a redirect from the assumed title. Simple example: {{Rws|Newport}}Newport but {{Rws|Newport|Essex}}Newport.

Dab solver

The Dab solver tool may automatically replace station templates by simple wikilinks, without making it obvious that the original text used templates. Rail editors are particularly keen that their templates not be expanded in that way. To avoid conflict when using Dab solver for railway stations, please view changes before saving, as well as using a preview.

Station

Template {{Station}}, usually abbreviated to stn, takes one unnamed parameter in the obvious way: {{Stn|Richmond}}Richmond. Unusually, disambiguation is provided by the third parameter, e.g. {{Stn|Richmond|​|London}}Richmond. Beware that adding any value as the second parameter capitalises the word Station instead: {{Stn|Richmond|London}}Richmond.

Adjacent stations

Many station articles show the next and previous station on each line using {{S-line}}. This template accepts |state1= to disambiguate the left station and |state2= to disambiguate the right station.

{{s-rail-start}}
{{s-rail|title=National Rail}}
{{s-line|system=National Rail |line=Without state |previous=Ashford |next=Swinton}}
{{s-line|system=National Rail |line=With state |previous=Ashford |next=Swinton |state1=Surrey |state2=Greater Manchester }}
{{s-end}}
Preceding station   National Rail National Rail   Following station
Without state
With state

The UK variant {{S-rail-national}} behaves similarly except that its disambiguation parameters are called |county1= and |county2=.

The newer {{Station link}}, which usually appears as its redirect stl, has a different solution. We need to edit Lua code in "Module:Adjacent stations/X", where X is the code after stl. For example, Line 21 (Guangzhou Metro) was linking to dab Changping station. The cause is {{GZM stations|Changping}}, which is a wrapper around {{stl|GZM|Changping}}. Looking up the code "GZM" gives us Module:Adjacent stations/GZM. That module consists of a require statement (Lua's equivalent of a soft redirect), telling us that this edit fixes the problem.

End of line stations

The station at the end of a line, typically prefixed by "toward" or "towards", may link to a dab. If the article uses s-line, a solution is:

  1. View the article's source and identify the {{s-line|system=σ|line=λ|…}} template corresponding to the rogue link, noting the text represented by σ and λ.
  2. View Template:S-line/σ left/λ or Template:S-line/σ right/λ, depending which end of the line contains the link; its text should be a station abbreviation α.
  3. Edit Template:σ stations, adding or updating the entry beginning with α=. (If appropriate, consider carefully updating a generic entry instead.)

Example fix: Template:MILW stations. Chicago Union Station linked to Tacoma instead of Tacoma, Washington. Here, system σ is "MILW", the bad link was on the left and line λ is "main", so {{S-line/MILW left/main}} reveals the station abbreviation α as "Seattle or Tacoma".

Road junctions

The road junction template {{Jct}} has an undocumented |nolink=y parameter, intended to permit plain text with no wikilink. It can be abused to supply a piped link: |city2=[[Town, Area|Town]]. This technique also works with clones such as {{Jcon}} (JunCtion ONtario). Example fix: Ontario Highway 417.

Taxonomy

Each taxon X has a template called {{Taxonomy/X}}, which can be viewed by clicking the red pencil icon on the right side of the "Scientific classification" line of the taxobox. Its |link= parameter is set to the contents of the link, excluding the square brackets. Normally this is a simple name such as |link=Mollusca. It can be set to a piped version such as |link=Kalinga (gastropod)|Kalinga. Example fix: Template:Taxonomy/Kalinga. Note the use of a literal | rather than {{!}}. You might expect this edit to set link to "Kalinga (gastropod)" and add a useless unnamed parameter "Kalinga" but, due to some magic, it works.

Topic and place

Links such as Communism in India and Military of Libya can result from templates which apply similar text manipulation to a category of places. For example, Communism in Korea uses {{Asia topic|Communism in}}, which forms links by prefixing each Asian nation by "Communism in ". Such links usually lead to articles but can exceptionally lead to a dab. In general, this problem is unsolved. Converting the disambiguation page to a BCA or SIA may be appropriate in some cases. Otherwise, this problem is not yet solved.

Wikidata labels

Some templates use Wikidata to identify related items, such as the riders in a cycling race, and attempt to link to the Wikipedia articles associated with those items. Unfortunately, a workaround for a different problem causes some of these links to be incorrect.

A Wikidata item can be associated with a Wikipedia article but not with a redirect. (Wikidata reached a consensus to allow redirects and recently discussed the matter again, but is still configured to prevent redirects from being associated.) Some templates have developed a workaround whereby, if the Wikidata item has no associated article, the item's English label is used. Sometimes that label matches a redirect to the relevant Wikipedia article. Sometimes it matches an unrelated article. Sometimes, as in the case of Q56883920, it leads to a dab.

A fix is to change the Wikidata label to a title not used in Wikipedia, if that can be done without disrupting Wikidata. A more drastic solution, as used at Archaeologist, is to briefly replace the Wikipedia redirect page by a dummy article, associate that article with the item, then revert to the redirect. Otherwise, this problem appears to be insoluble until Wikidata implements its decision to unblock redirects and the template workarounds can be removed.