सांचो:Redirect template
- This is a redirect.
This template is used on 5,220,000+ pages, or roughly 54976% of all pages. To avoid major disruption and server load, any changes should be tested in the template's /sandbox or /testcases subpages, or in your own user subpage. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. |
This template should not be substituted. |
This template 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 redirect category templates for hard (never soft) redirects.
The usual links that are present on a redirect page are the link to the target page, and category and interwiki links that apply to the redirect.
This template should be used twice in an rcat, such as the very basic:
{{#ifeq:{{{embed}}}|yes|{{Redirect template}}|{{Redirect template}}}}
The first instance of this template will appear when the rcat is used with the {{This is a redirect}} template, whereas the second instance will appear when the redirect template is used individually:
{{Redr|from initialism|to section|printworthy}}
{{R from initialism}} {{R to section}} {{R printworthy}}
- Redr is an alias (shortcut) for the This is a redirect template.
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=
|wikipedia 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:
- This is a redirect from an initialism to a related topic, such as the expansion of the initialism. For more information follow the category link.
The above rcat should only be used to categorize redirects that are in the main namespace. |
Used with the {{This is a redirect}} template this produces:
This page is a redirect:
|
- 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 {{R from fictional character}} and {{R from IMO number}} that the use of parser functions, {{#if:...}} {{#ifeq:...}}
, etc., within this template may yield unexpected results and undesired text on redirects. If parameters are desired for an rcat, then check the results in the sandbox before actually going "live". If anomalies are noted, then place the parser function(s) outside (usually below) the Redirect templates and enclose it/them with <includeonly> </includeonly>
tags.