Template:Redirect template
- This is a redirect.
This template is used on a very large number of pages. To avoid large-scale disruption and unnecessary server load, any changes to this template should first be tested in its /sandbox or /testcases subpages, or in your own user space. The tested changes can then be added to this page in one single edit. Please consider discussing any changes on the talk page before implementing them. |
This template should not be substituted. |
Uses Lua: |
This is a template for standardising redirect templates. The message produced by this template is intended to be transcluded onto redirect pages via redirect category (Rcat) templates.
When transcluded into the namespace indicated by a parameter, it categorises that page according to the parameter.
Usage
Only use this template in other redirect templates for hard redirects.
The only links that should be present on a redirect page are the link to the target page, and category and interwiki links that apply to the redirect. Other links on redirect pages cause problems with "What links here".
This template should be used twice in a redirect template:
{{#ifeq:{{{embed}}}|yes|{{Redirect template}}|{{Redirect template}}}}
The first instance of this template will appear when used with the {{This is a redirect}} template, whereas the second instance will appear when the redirect template is used individually:
{{This is a redirect|from initialism}}
{{R from initialism}}
Parameters
All the parameters should be used, except only one of either from or to needs to be used (both can be used) and printworthy should only be used where applicable. All parameters except name should be used in both halves of the redirect template. The parameters used in both halves should be identical (apart from a link in from or to).
When the "This is a redirect" template is used, the parameter |name=From example
adds the text "From example:" before "This is a redirect...". The text "From example" will be automatically linked to the redirect category that is populated by the redirect template. This "name" parameter should be used only in the first half of the redirect template.
The parameter |from=another example
adds the text "from another example" after "This is a redirect". The parameter |to=a third example
adds the text "to a third example" after "This is a redirect" (or after the from parameter if that is also used). In the second half, one of these two parameters should contain a bolded link to the category that is populated by the redirect template.
The parameter |info=This is extra information.
produces the text "This is extra information." after the first sentence, allowing extra information about the type of redirect to be displayed, if necessary. Too much extra information should be avoided, as it can be included on the corresponding category page instead.
The category parameters add pages with redirect templates using this template to categories. Use the parameter for the namespace the template will be used in:
|main category=Redirects from examples
,|help category=
,|portal category=
,|talk category=
(for all talk namespaces),|template category=
|TechInfoDepot category=
or|user category=
.|all category=
adds the category to pages in any namespace.- Parameters for other namespaces do not exist because no hard redirects should exist to or from those namespaces.
A namespace parameter can be used in conjunction with |other category=
. This parameter will add its category to pages in any namespace other than the specified namespace parameter's category.
The category parameters in the second half should be wrapped in <includeonly></includeonly>
tags to stop the redirect template itself from being placed in the categories or the {{Incorrect redirect template}} message box appearing on the redirect template page. Do not "includeonly" the parameters in the first half, because it will prevent the link from being added to the text created by the name parameter.
The parameter |printworthy=
(valid only for {{Redirect template}}, not for {{Redirect template/core}}) will categorise main namespace pages into Category:Printworthy redirects or Category:Unprintworthy redirects depending on whether the parameter equals "yes" or "no", respectively.
Example
{{#ifeq:{{{embed}}}|yes |{{Redirect template |name=From an initialism |from=an initialism |to=a related topic, such as the expansion of the initialism |main category=Redirects from initialisms }} |{{Redirect template |from=an '''[[:Category:Redirects from initialisms|initialism]]''' |to=a related topic, such as the expansion of the initialism <includeonly> |main category=Redirects from initialisms</includeonly> }} }}<noinclude> {{Documentation}} </noinclude>
Used individually as in {{R from initialism}} this produces: Template:R from initialism
Used with the {{This is a redirect}} template this produces:
This page is a redirect:Template:Rinit When appropriate, protection levels are automatically sensed, described and categorized. |
- Note: Template "This is a redirect" detects protection levels – in this example it senses that "Redirect template" is template protected. That notice does not appear when the documentation page is viewed, because that page is not protected from editing.
Incorrect usage
When an Rcat equipped with this template tags a redirect in the wrong namespace, the following notice will be seen on the redirect page:
The above Rcat should only be used to categorize redirects that are in the {{{1}}} namespace. |
where {{{1}}} is replaced by a link to the namespace specified by the Rcat.
Also, the redirect will not populate the expected category of the Rcat. The incorrectly tagged redirect will populate Category:Pages with templates in the wrong namespace, instead.
Usage note
It was found at {{CharR to list entry}} that the use of parser functions, {{#if:... {{#ifeq:...
, etc., within this template may yield unexpected/undesired text on redirects. If parameters are desired for an Rcat, place parser functions outside the Redirect template enclosed with <includeonly> </includeonly>
tags.
Technical note
This template calls {{Redirect template/core}}, which is used to prevent a template loop caused by printworthiness code. For more information, see the talk page discussion.
See also
- {{This is a redirect/Comparison}}
- TechInfoDepot:Template messages/Redirect pages
- WikiProject Redirect/Style guide
The above documentation is transcluded from Template:Redirect template/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |