Template:Format link/doc
This is a documentation subpage for Template:Format link. It may contain usage information, categories and other content that is not part of the original template page. |
This template formats a link for use in hatnote templates. It accepts up to three positional parameters, the link, an optional display value, and an optional target override (which if provided, makes the link parameter optional). These parameters may also be supplied by name, as link, display, and target respectively. Links to categories and files are automatically escaped with the colon trick, and links to sections are automatically formatted as page § section, rather than the MediaWiki default of page#section.
This template doesn't work with subst.
Usage[edit source]
Link only:
Link plus display:
Link with an italicized page name:
Link with an italicized section name:
If the link or display values contain an equals sign, you will need to specify the parameter names like this:
Link with a target override:
Link with parameters supplied by name:
Examples[edit source]
- Template:Tlc → [[Lion]] → Lion
- Template:Tlc → [[Lion#Etymology|Lion § Etymology]] → Lion § Etymology
- Template:Tlc → [[:Category:Lions]] → Category:Lions
- Template:Tlc → [[Lion#Etymology|Etymology of lion]] → Etymology of lion
- Template:Tlc → [[:Foo#Bar|§ Bar]] → § Bar
- Template:Tlc → [[Quo warranto#Philippines|<i>Quo warranto</i> § Philippines]] → Template:Format hatnote link
- Template:Tlc → [[Cybercrime Prevention Act of 2012#Disini v. Secretary of Justice|Cybercrime Prevention Act of 2012 § <i>Disini v. Secretary of Justice</i>]] → Template:Format hatnote link
- Template:Tlc → Lua error in package.lua at line 80: module 'Module:Error' not found.
Errors[edit source]
If this template is used and neither the link parameter (or positional parameter 1) nor the target parameter (or positional parameter 3) is supplied, then the template will return an error message. At least one of those must be supplied.
See also[edit source]
- {{Format linkr}} – an arguably better version of this template which converts underscores to spaces and calls {{urldecode}} on the input
- {{Section link}}
- {{formatter link}} – a template for applying a Wikidata Template:Q