Template:Anchor/doc: Difference between revisions
Jump to navigation
Jump to search
(Created page with "{{Documentation subpage}} <!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE --> The template {{tl|anchor}} inserts one or more [[Wikipedia:HTML element#Anc...") |
mNo edit summary |
||
Line 24: | Line 24: | ||
<includeonly> | <includeonly> | ||
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS --> | <!-- CATEGORIES AND INTERWIKIS HERE, THANKS --> | ||
[[Category: | [[Category:Formatting templates]] | ||
</includeonly> | </includeonly> | ||
<noinclude>[[Category:Template documentation]]</noinclude> |
Revision as of 14:18, 9 February 2013

This subpage provides documentation for Template:Anchor.
The template {{anchor}} inserts one or more HTML anchors in a page. Those locations can then be linked to using [[#link|...]]
syntax.
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. Consider using Template:Tlsp beneath the section title to generate an HTML comment alerting other editors to the purpose of anchors used in this manner.
- The following is an example of what not to do:
== Section title
{{anchor|bar}}
==
- Here, the link [[articlename#bar]] would take the user to the section, but undesirably hide the section title from view.
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.