Template:Anchor/doc

From RationalWiki
Jump to navigation Jump to search

The template {{anchor}} inserts one or more HTML fragment identifiers (anchor names) in a page. Those locations can then be linked to using [[#location|…]] syntax.

Examples

1. {{anchor|Foo}}

could be linked to with [[#Foo|…]] from within the same article,
or it could be linked to with [[Article name#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 [[Article name#Foo]] would remain valid even if the section were renamed. Consider using {{wikipedia:anchor comment}} after the section title to generate a HTML comment alerting other editors to the purpose of anchors used in this manner. See Limitations for the editing problems this use introduces.
The following is an example of what not to do:
== Section title{{anchor|Bar}}==
Here, the link [[Article name#Bar]] would take the user to the section, but could hide the section title from view.

Limitations

See wikipedia:Template:Anchor#Limitations.