Template:Anchor/doc: Difference between revisions
Template page
More actions
{{documentation subpage}} |
|||
| Line 24: | Line 24: | ||
''[[Template:Anchor#Example anchor]] (from another page) or [[#Example anchor]] (from this page) will now link to the section called "Usage", as seen above.'' | ''[[Template:Anchor#Example anchor]] (from another page) or [[#Example anchor]] (from this page) will now link to the section called "Usage", as seen above.'' | ||
<includeonly> | |||
[[Category:Formatting templates]] | |||
[[Category:Internal link templates]] | |||
[[ar:template:anchor]] | [[ar:template:anchor]] | ||
[[bg:template:anchor]] | [[bg:template:anchor]] | ||
| Line 72: | Line 74: | ||
[[yi:template:anchor]] | [[yi:template:anchor]] | ||
[[zh:template:anchor]] | [[zh:template:anchor]] | ||
</includeonly> | |||
Revision as of 15:34, 3 July 2011
Usage
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.
3. The template can be used to create up to ten anchors with a single call. For example,
{{anchor|foo|bar|baz}}- will create three anchors that can then be linked to with [[#foo]], [[#bar]] and [[#baz]].
- Specifying more than 10 anchors will cause an error message to be displayed.
Example
====Usage {{anchor|Example anchor}}====
or
====Usage {{anchor|anchor=Example anchor}}====
Template:Anchor#Example anchor (from another page) or #Example anchor (from this page) will now link to the section called "Usage", as seen above.