Template:Anchor/doc: Difference between revisions
Template page
More actions
doc from template page |
adding info from enwiki @ http://en.wikipedia.org/w/index.php?title=Template:Anchor/doc&oldid=338944514 |
||
| Line 1: | Line 1: | ||
==Usage {{ | ==Usage== | ||
1. <code style="color:green;"><nowiki>{{</nowiki>{{lc:{{BASEPAGENAME}}}}|foo<nowiki>}}</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, | ||
: <nowiki><</nowiki> | :<code style="color:green;"><nowiki>=={{</nowiki>{{lc:{{BASEPAGENAME}}}}|foo<nowiki>}}</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. | |||
3. The template can be used to create up to ten anchors with a single call. For example, | |||
: <code style="color:green;"><nowiki>{{</nowiki>{{lc:{{BASEPAGENAME}}}}|foo|bar|baz<nowiki>}}</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. | |||
==Example== | ==Example== | ||