Template:Anchor/doc: Difference between revisions

From Path of Exile Wiki
Jump to navigation Jump to search
mNo edit summary
>Kaseki
(Replaced content with "{{WikipediaTemplate}}")
Line 1: Line 1:
{{Documentation subpage}}
{{WikipediaTemplate}}
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
 
The template {{tl|anchor}} inserts one or more [[Wikipedia:HTML element#Anchor|HTML anchor]]s in a page. Those locations can then be linked to using <code><nowiki>[[#link|...]]</nowiki></code> syntax.
 
==Usage==
1. <code style="color:green;"><nowiki>{{anchor|foo}}</nowiki></code>
: could be linked to with <tt><nowiki>[[#foo|...]]</nowiki></tt> from within the same article,
: or it could be linked to with <tt><nowiki>[[</nowiki>''<small>articlename</small>''#foo|...<nowiki>]]</nowiki></tt> from other articles and from redirects.
 
2. Anchors can be more suitable for inter-article linking than section titles are. For example,
: <code style="color:gray;"><nowiki>==</nowiki></code> <code style="color:green;"><nowiki>{{anchor|foo}}</nowiki></code> <code style="color:gray;">Section title <nowiki>==</nowiki></code>
: Here, links via <tt><nowiki>[[</nowiki>''articlename''#foo<nowiki>]]</nowiki></tt> would remain valid even if the section were renamed. Consider using {{tlsp|anchor comment}} 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:
: <code style="color:gray;"><nowiki>==</nowiki> Section title</code> <code style="color:green;"><nowiki>{{anchor|bar}}</nowiki></code> <code style="color:gray;"><nowiki>==</nowiki></code>
: Here, the link <tt><nowiki>[[</nowiki>''articlename''#bar<nowiki>]]</nowiki></tt> 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,
: <code style="color:green;"><nowiki>{{anchor|foo|bar|baz}}</nowiki></code>
: will create three anchors that can then be linked to with <tt><nowiki>[[#foo]]</nowiki></tt>, <tt><nowiki>[[#bar]]</nowiki></tt> and <tt><nowiki>[[#baz]]</nowiki></tt>.
: Specifying more than 10 anchors will cause an error message to be displayed.
 
<includeonly>
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
[[Category:Formatting templates]]
</includeonly>
<noinclude>[[Category:Template documentation]]</noinclude>

Revision as of 15:07, 22 February 2013

This template was adapted from Template:Anchor/doc on Wikipedia.
Adaptation is noted for reference and attribution only. This template may differ from the original in function or in usage. The documentation on Wikipedia may be helpful in understanding this template.