DefaultLinks
![No No](https://commons.wiki.gg/images/thumb/d/db/Icon_delete.png/37px-Icon_delete.png)
DefaultLinks is an extension that can be used to format a page's link. It was built for Warcraft Wiki (in 2010) and has since been adopted by other communities, including the Hearthstone Wiki.
Syntax
A parser function specifies the default link format for the page it appears on (even if transcluded):
{{DEFAULTLINK:link wikitext|page title|options}}
Parameter | Required? | Description |
---|---|---|
link wikitext | Required | Wiki-formatted default link text, which must contain a link back to the original page; the formatting text should, as far as possible, be plain wiki text (without use of parser tags). |
page title | Optional | If provided, the link formatting will only be used for the page with this title; otherwise, the formatting will be used on all pages this tag is on if the link wikitext contains a link back to the page in question. |
options | Optional | If this argument contains "silent", some warnings about invalid usage will not be output. |
Currently, only pages in the main namespace are allowed to override default link formatting. This can be updated to include additional namespaces by modifying "MediaWiki:Defaultlinks-enabled-namespaces", separating the namespace IDs with a comma.
If multiple DEFAULTLINK calls appear on one page but specify differing link formatting, a warning will be displayed on the page (from "MediaWiki:duplicate-defaultlink") and the page is placed in "Category:Pages with DEFAULTLINK conflicts".
Avoiding default formatting
The extension will only format caption-less links to pages in the main namespace; the links must also not begin with a colon. Thus, [[Link]]
will be formatted, while [[Link|Link]]
, [[Link]]s
, and [[:Link]]
will not. Therefore, it is enough to simply provide a caption (i.e. [[Link|Link]]
) if you wish to avoid applying default formatting to a link.
The formatting is suppressed inside <nodefaultlinks>...</nodefaultlinks>
tags, making those a viable option for avoiding default formatting within, for example, a navbox.
Placing the __NODEFAULTLINKS__
magic word on a page suppresses default link formatting on the entire page.
Example
Create a template (e.g. an infobox) with the DEFAULTLINK function. The function can look something like this:
{{DEFAULTLINK:[[{{FULLPAGENAME}}|<span class="some-class" style="color:var(--wiki-accent-color);">{{{name}}}</span>]]}}
Then add the template to the designated page and as the page gets linked to across the wiki, it'll format the link like so:
For real world examples, see the section "Usage on Warcraft Wiki" section over on Warcraft Wiki: