Difference between revisions of "Template:Shortcut"
m (Add left float because we might need it soon) |
m (Do not emit </ul> if there is no first element (not that this template is seeing use)) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 4: | Line 4: | ||
<table class="shortcutbox noprint" style="float: {{{float|right}}}; border: 1px solid #aaa; background: #fff; margin: .3em .3em .3em 1em; padding: 3px; text-align: center;"><tr><th style="border: none; background: transparent;" class="plainlist"><!-- | <table class="shortcutbox noprint" style="float: {{{float|right}}}; border: 1px solid #aaa; background: #fff; margin: .3em .3em .3em 1em; padding: 3px; text-align: center;"><tr><th style="border: none; background: transparent;" class="plainlist"><!-- | ||
Adding the shortcut links: | Adding the shortcut links: | ||
− | --><small>[[w:Shortcut|Shortcut{{#if:{{{2|}}}|s}}]]: | + | --><small>[[w:WP:Shortcut|Shortcut{{#if:{{{2|}}}|s}}]]: |
{{#if:{{{1|}}}|<ul><li> [[{{{1}}}]]</li> | {{#if:{{{1|}}}|<ul><li> [[{{{1}}}]]</li> | ||
}}{{#if:{{{2|}}}|<li> [[{{{2}}}]]</li> | }}{{#if:{{{2|}}}|<li> [[{{{2}}}]]</li> | ||
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|}}} |
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.