Template:Anchor/doc: Difference between revisions
More actions
add description, use TemplateData, remove dead interlanguage link |
Update |
||
| Line 1: | Line 1: | ||
{{TemplateBox | {{TemplateBox | ||
|1 = | |1 = 1 | ||
|1d-en = The text that will be the anchor | |1d-en = The text that will be the first anchor | ||
|1label = anchor | |1label = First anchor | ||
|1type = string/line | |1type = string/line | ||
|1def = anchor | |1def = anchor | ||
|1stat = required | |1stat = required | ||
|2 = 2 | |||
|2d-en = The text that will be the second anchor | |||
|2label = Second anchor | |||
|2type = string/line | |||
|2def = anchor | |||
|2stat = optional | |||
|3 = 3 | |||
|3d-en = The text that will be the third anchor | |||
|3label = Third anchor | |||
|3type = string/line | |||
|3def = anchor | |||
|3stat = optional | |||
|4 = 4, 5, ... | |||
|4d-en = For additional anchors, just add additional anchors (the template isn't limited to three) | |||
|4label = 4th, 5th, ... anchor | |||
|4type = string/line | |||
|4def = anchor | |||
|4stat = optional | |||
|name = anchor | |name = anchor | ||
Revision as of 10:48, 14 February 2020
This template creates an anchor where it is placed, that is, a point which can be linked like a section header either from somewhere within that page, another Commons page, or another website. It has no visual output.
Usage
{{anchor |1= |2= |3= |4, 5, ...= }}
1. {{anchor|foo}}
- could be linked to with [[#foo|...]] from within the same article,
- or it could be linked to with [[articlename#foo|…]] from other articles and from redirects.
2. Anchors can be more suitable for inter-article linking than section titles are. For example,
=={{anchor|foo}}Section title ==- Here, links via [[articlename#foo]] would remain valid even if the section were renamed.
Template parameters
- TemplateData
TemplateData is a way to store information about template parameters (the description of those and of the whole template) for both humans and machines. It is used by VisualEditor and possibly other tools like Upload Wizard.
Existing template documentation
At Wikimedia Commons, it is recommended to use {{TemplateBox}} with either useTemplateData=1 or useTemplateData=only on the /doc subpage and transcluding it with {{Documentation}} into the template. <nowiki>-tags can be wrapped around the arguments, if required, to avoid templates being expanded.
Newly created template documentation and imports
Another option, especially for imported templates, or for users with JSON experience, is placing raw <templatedata>-tags into the Wikitext of the template, as described in various Wikipediae.
Wikipedia's help about TemplateData • Commons-specific information
This template creates an anchor where it is placed, that is, a point which can be linked like a section header either from somewhere within that page, another Commons page, or another website. It has no visual output.
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| First anchor | 1 | The text that will be the first anchor
| Line | required |
| Second anchor | 2 | The text that will be the second anchor
| Line | optional |
| Third anchor | 3 | The text that will be the third anchor
| Line | optional |
| 4th, 5th, ... anchor | 4, 5, ... | For additional anchors, just add additional anchors (the template isn't limited to three)
| Line | optional |
Additional information
The template is intended to be used in the following namespaces: all namespaces
The template is intended to be used by the following user groups: all users
Localization
This template is not intended to be localized.