Template:W
| This template is used on a slew of pages. (count) Changes to this template may cause some server load, and mistakes will be visible on many pages. Please carefully test any edits before making them, and avoid making unnecessary edits. |
| {{w}} | ||||
|---|---|---|---|---|
| non-local links 2,116 |
local links 697 |
forced links 31 |
||
| recent articles | ||||
|
|
||||
This template generates a conditional link — either to a local target if it exists, or to Wikipedia if the local target does not exist.
{{w|target}}{{w|target|label}}{{w|target|anchor=section|label}}
Optional named parameter {{{anchor}}} links to a specific section of a Wikipedia page, and does not attempt to autodetect a local target. It should be rarely used; eliminating template calls that use it requires idiosyncratic remedies.
Exercise care when removing calls to this template from a page: it is used, in part, to keep track of page categorization.
- If the local target doesn't exist, you probably shouldn't be removing the template call.
- If the local target does exist, consider whether the calling page should belong to some category associated with the local target, and if it should belong but doesn't, add it to that category. Then eliminate the locally linking template call by changing
{{w|...}}to[[...]].
This template populates three hidden categories: when linking to Wikipedia (without an anchor), it adds the calling page to Category:Pages with defaulting non-local links; when linking to the local target, it adds the calling page to Category:Pages with categorizable local links; when linking to Wikipedia with an anchor, it adds the calling page to Category:Pages with forced foreign links.
When linking to Wikipedia from the secure server, this template makes a secure link.
A gadget is provided to complement this template, "Underline in green categorizable {{w}} links". The gadget also puts a dashed underline on forced foreign {{w}} links.
[edit] Other parameters
Optional parameter {{{nocat}}} can be set to any non-blank value to suppress categorization of the calling page based on this template call.
Optional parameter {{{foreign}}} can be set to either of two values to cause specialized effects. This optional parameter is ignored if {{{anchor}}} is used.
- foreign=force links to Wikipedia, without checking for a local target. Categorizes to Category:Pages with forced foreign links.
- foreign=suppress behaves as usual for local links, but if the link would be to Wikipedia, the label is unlinked. Does not affect categorization, which is still to Category:Pages with defaulting non-local links.


