Difference between revisions of "Template:Shortcut"
GrampaSwood (talk | contribs) m (Should hopefully fix this page being in the category without affecting the template itself, changed link to link to the WP:SHORTCUT rather than the Wikipedia page for shortcuts) |
m (Do not emit </ul> if there is no first element (not that this template is seeing use)) |
||
(One intermediate revision by one other user not shown) | |||
Line 16: | Line 16: | ||
}}{{#if:{{{10|}}}|<li> [[{{{10}}}]]</li> | }}{{#if:{{{10|}}}|<li> [[{{{10}}}]]</li> | ||
}}{{#if:{{{msg|}}}|<li> {{{msg}}}</li> | }}{{#if:{{{msg|}}}|<li> {{{msg}}}</li> | ||
− | }}</ul></small></th></tr></table><!-- | + | }}{{#if:{{{1|}}}|</ul>}}</small></th></tr></table><!-- |
Reporting if the first parameter is not a valid non-bracketed shortcut name: | Reporting if the first parameter is not a valid non-bracketed shortcut name: | ||
-->{{#if:{{{1|}}} | -->{{#if:{{{1|}}} | ||
| {{#ifexist:{{{1|}}} | | {{#ifexist:{{{1|}}} | ||
| | | | ||
− | | [[ | + | | [[Category:Wikipedia shortcut box first parameter needs fixing|{{PAGENAME}}]] |
}} | }} | ||
}}<noinclude> | }}<noinclude> |
Latest revision as of 16:01, 28 March 2023
A shortcut template is similar to the {{anchor}}
template, but it adds a visual box graphic to the rendered page, as well as providing an alternative name. Creating a redirect page is a requirement to fulfill the shortcut mechanism.
Contents
Usage
This template is not normally used for articles in the main namespace, because the graphic produces an avoidable self-reference.
- Insert the shortcut template.
- Create a redirect page. Name the page after your shortcut name. Include the namespace name in both the shortcut name and the redirect page name. For example, substitute your own shortcut name as the title of the page, and substitute the proper namespace, then add the following as the top-line on your redirect page:
- #REDIRECT [[''Namespace'':''Title of page with''#''Optional very long section name'']]
- Verify operation. Note that shortcut templates should display in all capitals, but operate without all capitals.
- Notes
These templates are mainly used on user pages and talk pages in reference to the TFW namespace. These templates inform about the shortcuts available to the page they are on. For example, w:SHORT redirects to w:Wikipedia:Shortcut and therefore, Wikipedia:Shortcut renders a shortcut box listing WP:SHORT. It is a self-reference that is normally avoided in the main article namespace.
The point of these templates is not to list every single redirect for a page (indeed, that's what "What links here" is for). Instead, they should list only one or two common and easily-remembered redirects.
The shortcut template can take up to ten (10) shortcuts as parameters.
Examples
Code | Result |
---|---|
{{Shortcut|W:WP:SHORT}}
|
|
{{Shortcut|W:WP:V|W:WP:VERIFY|W:WP:SOURCE}}
|
Anchors
These templates automatically add anchors. If a shortcut box with the shortcut w:WP:SHORT is placed on the page w:Wikipedia:Shortcut, then the link w:Wikipedia:Shortcut#WP:SHORT will take you to the position in the page where that shortcut box is placed.
Thus, if you make a shortcut for a section of a page, then you can use the anchor in the shortcut redirect itself. Like this:
#REDIRECT [[Pagename#WP:SHORT]]
See also
- w:Shortcut – The how-to guide and guideline about how and when to create shortcuts and shortcut boxes. A must-read for anyone handling shortcuts.