Template:Template shortcut/sandbox
This is the template sandbox page for Template:Template shortcut (diff). See also the companion subpage for test cases. |
This template is used on approximately 4,600 pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them. |
This template uses Lua: |
This template displays one or more of a template's shortcuts (that is, redirects, also known as aliases), as in the box appearing at the right. {{Tsh}} is a shortcut to this template, {{template shortcut}}, and can be used in its place, as it is in this documentation's source wikitext.
Usage
[edit]Place this template and its list of few to one, carefully selected shortcut(s) at the top of the template documentation page's wikitext, right underneath {{Documentation subpage}}. In the saved, rendered text, those shortcuts will appear in this template's Shortcut(s) box, whose title will reflect the number of list items by automatically being singular or plural in form.
Which ones to display here
[edit]Although the template can show up to ten shortcuts, you are encouraged to choose well which ones to display in this template's box. Even if many redirects exist, two or three at the most is almost always enough. By keeping the number of redirects presented in the Shortcut box small, it makes it easier to remember them, and the documentation is kept well organized.
Where to list any others
[edit]List others in the Redirects section of the template documentation. Again, not all of them need to be listed; some shortcuts are there just for historical reasons, and others differ only in minor points such as white spaces or capitalization. Such shortcut-name variations are unnecessary to list at all—just list the standard, most common version of such a variation.
Optional parameters
[edit]This template has several optional parameters:
- float – if set to "left", then the box will float to the left of the page, instead of the default float "right".
- clear – if set to "right" (when float also is set to "right"), the box will be pushed to the right margin of the page, and prevent it from nest to the left of other right-floating elements.[clarification needed] Similarly, if set to "left" (when float also is set to "left"), the box will be pushed to the left margin of the page.
- pre – can be used to show some text before the shortcut links, but within the braces. This is mostly used to add the text "subst:". This shows the proper syntax for using the template with substitution.
- pre1, pre2 ... – like above, but adds the prefix only to the nth shortcut.
Examples of basic code
[edit]To display one template shortcut named {{uw-v1}}:
{{template shortcut|uw-v1}}
To display three template shortcuts for {{uw-vandalism1}} named {{uw-v1}}, {{uw-vand1}}, and {{uw-vandal1}}:
{{template shortcut|uw-v1|uw-vand1|uw-vandal1}}
Example with the float parameter
[edit]Using |float=left
makes this template flow to the left of the page:
{{template shortcut|float=left|uw-v1}}
Example with text ("subst:") within the braces
[edit]This is mostly used to add text to show how the template could be used with substitution.
Use |pre2=subst:
and |pre3=subst:
to show "subst:" before the shortcut links, but within the braces:
{{template shortcut|uw-v1|pre2=subst:|uw-vand1|pre3=subst:|uw-vandal1}}
If you use |pre=subst:
, it applies to all of the shortcuts:
{{template shortcut|pre=subst:|uw-v1|uw-vand1|uw-vandal1}}
TemplateData
[edit]TemplateData for Template shortcut
This template displays one or more of a template's shortcuts.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Redirect? | redirect | Whether to refer to the "shortcut/s" as "redirect/s" instead.
| Boolean | optional |
Target? | target | Whether to not add the <code>redirect=no</code> URL parameter.
| Boolean | optional |
Float | float | The CSS <code>float</code> property value.
| String | optional |
Clear | clear | The CSS <code>clear</code> property value.
| String | optional |
Categorize | category | Whether to add pages to the error category if no alias or <code>msg</code> is specified.
| Boolean | optional |
Message | msg | An unlinked message that goes after the shortcut links. | Content | optional |
Default prefix | pre | The default prefix
| String | optional |
Prefix 1 | pre1 | Prefix for template shortcut 1
| String | optional |
Shortcut 1 | 1 | Template shortcut 1 | Template | required |
Prefix 2 | pre2 | Prefix for template shortcut 2
| String | optional |
Shortcut 2 | 2 | Template shortcut 2 | Template | optional |
Prefix 3 | pre3 | Prefix for template shortcut 3
| String | optional |
Shortcut 3 | 3 | Template shortcut 3 | Template | optional |
Prefix 4 | pre4 | Prefix for template shortcut 4
| String | optional |
Shortcut 4 | 4 | Template shortcut 4 | Template | optional |
Prefix 5 | pre5 | Prefix for template shortcut 5
| String | optional |
Shortcut 5 | 5 | Template shortcut 5 | Template | optional |
Prefix 6 | pre6 | Prefix for template shortcut 6
| String | optional |
Shortcut 6 | 6 | Template shortcut 6 | Template | optional |
Prefix 7 | pre7 | Prefix for template shortcut 7
| String | optional |
Shortcut 7 | 7 | Template shortcut 7 | Template | optional |
Prefix 8 | pre8 | Prefix for template shortcut 8
| String | optional |
Shortcut 8 | 8 | Template shortcut 8 | Template | optional |
Prefix 9 | pre9 | Prefix for template shortcut 9
| String | optional |
Shortcut 9 | 9 | Template shortcut 9 | Template | optional |
See also
[edit]- {{shortcut}}, the standard shortcut notice.
- {{policy shortcut}}, for shortcuts to sections of policy pages.
- {{R to redirect template}}, the rcat template for redirects to rcat templates
- {{template redirect}}, automatically sets
redirect=yes