Template:Redirect/doc: Difference between revisions
en>SWinxy Copy selfref documentation text from Template:For/doc; see that page's edit history for attribution |
Orangestar (talk | contribs) No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
{{tsh|redir}} | {{tsh|redir}} | ||
{{notice|1=Using this template does '''not''' create a redirect. The following pages may have what you are looking for: | {{notice|1=Using this template does '''not''' create a redirect. The following pages may have what you are looking for: | ||
* [[Wikipedia:Redirect]] is the official Wikipedia guideline on redirects. The page focuses on the rules and standards that the Wikipedia community has agreed to [[WP:Common sense|generally]] follow regarding redirects. | * [[Wikipedia:Redirect]] is the official Wikipedia guideline on redirects. The page focuses on the rules and standards that the Wikipedia community has agreed to [[wikipedia:WP:Common sense|generally]] follow regarding redirects. | ||
* [[Help:Redirect]] is a how-to page that focuses on the technical aspects of redirects. It instructs editors on how redirects work and how to handle them without causing errors. | * [[Help:Redirect]] is a how-to page that focuses on the technical aspects of redirects. It instructs editors on how redirects work and how to handle them without causing errors. | ||
* [[Template:R template index|R template index]] contains a large list of templates that are used in order to tag and categorize redirects. | * [[Template:R template index|R template index]] contains a large list of templates that are used in order to tag and categorize redirects. | ||
Line 11: | Line 11: | ||
==Description and use== | ==Description and use== | ||
This template produces a [[Wikipedia:Hatnote|hatnote]]: | This template produces a [[wikipedia:Wikipedia:Hatnote|hatnote]]: | ||
* {{tlx|Redirect|Foo}} → {{Redirect|Foo}} | * {{tlx|Redirect|Foo}} → {{Redirect|wikipedia:Foo}} | ||
It is placed at the top of the article or section that is [[WP:PRIMARYREDIRECT|the primary topic of a redirect]], and links to other topics that are ambiguous with the name of that redirect. This template is used instead of the generic {{tl|for}} in order to reduce reader confusion. | It is placed at the top of the article or section that is [[wikipedia:WP:PRIMARYREDIRECT|the primary topic of a redirect]], and links to other topics that are ambiguous with the name of that redirect. This template is used instead of the generic {{tl|for}} in order to reduce reader confusion. | ||
An example would be when a user searches for the emperor [[Achilleus (emperor)|Achilleus]]. However, the search term "Achilleus" redirects to the page titled [[Achilles]] (as in the mythical hero) because it is considered more likely the user were searching for the very well known hero than a relatively obscure emperor. Now, at the top of this Achilles page you will (among other things) find the following hatnote: | An example would be when a user searches for the emperor [[wikipedia:Achilleus (emperor)|Achilleus]]. However, the search term "Achilleus" redirects to the page titled [[wikipedia:Achilles|Achilles]] (as in the mythical hero) because it is considered more likely the user were searching for the very well known hero than a relatively obscure emperor. Now, at the top of this Achilles page you will (among other things) find the following hatnote: | ||
: ''"Achilleus" redirects here. For the Roman emperor with this name, see [[Achilleus (Roman usurper)]].'' | : ''"Achilleus" redirects here. For the Roman emperor with this name, see [[wikipedia:Achilleus (Roman usurper)|Achilleus (Roman usurper)]].'' | ||
That text is this template in action. | That text is this template in action. | ||
Line 26: | Line 26: | ||
== Examples == | == Examples == | ||
* {{tlx|Redirect|Foo}} → {{Redirect|Foo}} | * {{tlx|Redirect|Foo}} → {{Redirect|wikipedia:Foo}} | ||
* {{tlx|Redirect|REDIRECT<nowiki>||</nowiki>PAGE1}} → {{Redirect|REDIRECT||PAGE1}} | * {{tlx|Redirect|REDIRECT<nowiki>||</nowiki>PAGE1}} → {{Redirect|REDIRECT||wikipedia:PAGE1}} | ||
* {{tlx|Redirect|REDIRECT|USE1|PAGE1}} → {{Redirect|REDIRECT|USE1|PAGE1}} | * {{tlx|Redirect|REDIRECT|USE1|PAGE1}} → {{Redirect|REDIRECT|USE1|wikipedia:PAGE1}} | ||
* {{tlx|Redirect|REDIRECT|USE1|PAGE1|USE2|PAGE2|USE3|PAGE3}} → {{Redirect|REDIRECT|USE1|PAGE1|USE2|PAGE2|USE3|PAGE3}} | * {{tlx|Redirect|REDIRECT|USE1|PAGE1|USE2|wikipedia:PAGE2|USE3|PAGE3}} → {{Redirect|REDIRECT|USE1|wikipedia:PAGE1|USE2|wikipedia:PAGE2|USE3|wikipedia:PAGE3}} | ||
* {{tlx|Redirect|REDIRECT|USE1|PAGE1|and|PAGE2}} → {{Redirect|REDIRECT|USE1|PAGE1|and|PAGE2}} | * {{tlx|Redirect|REDIRECT|USE1|wikipedia:PAGE1|and|wikipedia:PAGE2}} → {{Redirect|REDIRECT|USE1|wikipedia:PAGE1|and|wikipedia:PAGE2}} | ||
* {{tlx|Redirect|REDIRECT|USE1|PAGE1|USE2|PAGE2|and|PAGE3}} → {{Redirect|REDIRECT|USE1|PAGE1|USE2|PAGE2|and|PAGE3}} | * {{tlx|Redirect|REDIRECT|USE1|PAGE1|USE2|PAGE2|and|PAGE3}} → {{Redirect|REDIRECT|USE1|wikipedia:PAGE1|USE2|wikipedia:PAGE2|and|wikipedia:PAGE3}} | ||
* {{tlx|Redirect|Achilleus|the Emperor with this name|Achilleus (emperor)|other uses|Achilles (disambiguation)}} (as used on the page [[Achilles]]) → {{Redirect|Achilleus|the Emperor with this name|Achilleus (emperor)|other uses|Achilles (disambiguation)}} | * {{tlx|Redirect|Achilleus|the Emperor with this name|Achilleus (emperor)|other uses|Achilles (disambiguation)}} (as used on the page [[wikipedia:Achilles]]) → {{Redirect|Achilleus|the Emperor with this name|wikipedia:Achilleus (emperor)|other uses|wikipedia:Achilles (disambiguation)}} | ||
The {{para|selfref|yes}} option marks the entire hatnote as a Wikipedia self-reference, causing it to be omitted when the page content is reused outside of Wikipedia (see {{tl|self reference}} and [[MOS:SELFREF]] for more details). | The {{para|selfref|yes}} option marks the entire hatnote as a Wikipedia self-reference, causing it to be omitted when the page content is reused outside of Wikipedia (see {{tl|self reference}} and [[wikipedia:MOS:SELFREF]] for more details). | ||
== More complex uses == | == More complex uses == | ||
Line 42: | Line 42: | ||
* {{tl|Redirect-several}} (for several redirects, without listing each) | * {{tl|Redirect-several}} (for several redirects, without listing each) | ||
* {{tl|Redirect-distinguish}} | * {{tl|Redirect-distinguish}} | ||
*{{tl|See Wiktionary}} with "redirect" field | * {{tl|See Wiktionary}} with "redirect" field | ||
* {{tl|Technical reasons}} | * {{tl|Technical reasons}} | ||
Line 99: | Line 99: | ||
"selfref": { | "selfref": { | ||
"label": "Is self-reference?", | "label": "Is self-reference?", | ||
"description": "Set to yes to make this hatnote invisible on e.g. printed versions, for [[WP:SELFREF]]s", | "description": "Set to yes to make this hatnote invisible on e.g. printed versions, for [[wikipedia:WP:SELFREF]]s", | ||
"type": "boolean", | "type": "boolean", | ||
"default": "no", | "default": "no", | ||
Line 114: | Line 114: | ||
* {{tl|no redirect}}, {{tlf|-r}} | * {{tl|no redirect}}, {{tlf|-r}} | ||
* {{tl|is redirect}}, returns yes/<blank> | * {{tl|is redirect}}, returns yes/<blank> | ||
*{{tl|Shortcut}}, for creating redirects primarily within the Wikipedia namespace that uses shorter names (e.g. [[MOS:SMALLCAPS]] or [[WP:AN]]). | *{{tl|Shortcut}}, for creating redirects primarily within the Wikipedia namespace that uses shorter names (e.g. [[wikipedia:MOS:SMALLCAPS]] or [[wikipedia:WP:AN]]). | ||
*[[Wikipedia:Template_index/Redirect_pages#List_of_redirects_by_function|Rcat functional index]] | *[[wikipedia:Wikipedia:Template_index/Redirect_pages#List_of_redirects_by_function|Rcat functional index]] | ||
<includeonly>{{Sandbox other|| | <includeonly>{{Sandbox other|| |
Latest revision as of 18:28, 13 June 2024
![]() | This template is used on approximately 75,000 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: |
Description and use[edit source]
This template produces a hatnote:
{{Redirect|Foo}}
→
It is placed at the top of the article or section that is the primary topic of a redirect, and links to other topics that are ambiguous with the name of that redirect. This template is used instead of the generic {{for}} in order to reduce reader confusion.
An example would be when a user searches for the emperor Achilleus. However, the search term "Achilleus" redirects to the page titled Achilles (as in the mythical hero) because it is considered more likely the user were searching for the very well known hero than a relatively obscure emperor. Now, at the top of this Achilles page you will (among other things) find the following hatnote:
- "Achilleus" redirects here. For the Roman emperor with this name, see Achilleus (Roman usurper).
That text is this template in action.
Parameters[edit source]
![]() | This section needs expansion. You can help by adding to it. |
A |text=
option adds text to the end; note that this should only be used when truly necessary, when the other hatnote templates listed below don't suffice.
Examples[edit source]
{{Redirect|Foo}}
→{{Redirect|REDIRECT||PAGE1}}
→{{Redirect|REDIRECT|USE1|PAGE1}}
→{{Redirect|REDIRECT|USE1|PAGE1|USE2|wikipedia:PAGE2|USE3|PAGE3}}
→{{Redirect|REDIRECT|USE1|wikipedia:PAGE1|and|wikipedia:PAGE2}}
→{{Redirect|REDIRECT|USE1|PAGE1|USE2|PAGE2|and|PAGE3}}
→{{Redirect|Achilleus|the Emperor with this name|Achilleus (emperor)|other uses|Achilles (disambiguation)}}
(as used on the page wikipedia:Achilles) →
The |selfref=yes
option marks the entire hatnote as a Wikipedia self-reference, causing it to be omitted when the page content is reused outside of Wikipedia (see {{self reference}} and wikipedia:MOS:SELFREF for more details).
More complex uses[edit source]
For more complex cases, other templates can be used:
- {{Redirect2}} (when there are two incoming redirects)
- {{Redirect-multi}} (for two or more redirects)
- {{Redirect-several}} (for several redirects, without listing each)
- {{Redirect-distinguish}}
- {{See Wiktionary}} with "redirect" field
- {{Technical reasons}}
TemplateData[edit source]
TemplateData for Redirect
This template produces a hatnote similar to: "Foo" redirects here. For other uses, see [[Foo (disambiguation)]].
Parameter | Description | Type | Status | |
---|---|---|---|---|
Redirecting page | 1 | Name of page that redirects here | Page name | required |
Use 1 | 2 | Displayed as: For Use 1, see ... If left empty, defaults to For other uses, see ... | Line | optional |
Target 1 | 3 | Page to link to. Default is [[PAGENAME (disambiguation)]]. | Page name | optional |
Use 2 | 4 | Second use. Can be 'and' to give: For Use 1, see [[Target1]] and [[Target2]]. | Line | optional |
Target 2 | 5 | Page to link second use to. | Page name | optional |
Use 3 | 6 | Third use. Can be 'and'. | Line | optional |
Target 3 | 7 | Page to link third use to. | Page name | optional |
Custom text | text | Text to be appended to the end. | Line | optional |
Is self-reference? | selfref | Set to yes to make this hatnote invisible on e.g. printed versions, for [[wikipedia:WP:SELFREF]]s
| Boolean | optional |
See also[edit source]
- {{no redirect}}, {{-r}}
- {{is redirect}}, returns yes/<blank>
- {{Shortcut}}, for creating redirects primarily within the Wikipedia namespace that uses shorter names (e.g. wikipedia:MOS:SMALLCAPS or wikipedia:WP:AN).
- Rcat functional index