Template:Anchor: Difference between revisions

From 2d4chan
Jump to navigation Jump to search
1d4chan>Not LongPoster Again
Handy utility template copypasta'd from Wikipedia.
 
1d4chan>Not LongPoster Again
m Cleaned up the page and added some more info.
Line 10: Line 10:
-->{{#if:{{{10|}}}|<span id="{{{10|}}}"></span>}}<!--
-->{{#if:{{{10|}}}|<span id="{{{10|}}}"></span>}}<!--
-->{{#if:{{{11|}}}|<span class="error">[[Template:Anchor]] (or Anchors): too many anchors, maximum is 10.</span>}}<noinclude>
-->{{#if:{{{11|}}}|<span class="error">[[Template:Anchor]] (or Anchors): too many anchors, maximum is 10.</span>}}<noinclude>
 
This template adds an HTML anchor to the page (silently, i.e. without displaying any text in the page's user-facing content).  Think of it as a "phantom section" that can be linked to by an internal link containing a pound sign -- e.g. if a page contains <nowiki>{{anchor|foo}}</nowiki>, that part of the page can be linked to by <nowiki>[[#foo]]</nowiki> from the same page, or <nowiki>[[Page Name#foo]]</nowiki> from another page.  Up to ten alternate titles can be defined at any call, e.g. <nowiki>{{anchor|foo|bar}}</nowiki> (using more results in an error).  Note that they are case-sensitive, and may not like special characters.
This template adds an HTML anchor to the page.  Think of it as a "phantom section" that can be linked to by an internal link containing a pound sign -- e.g. if a page contains <nowiki>{{anchor|foo}}</nowiki>, that part of the page can be linked to by <nowiki>[[#foo]]</nowiki> from the same page, or <nowiki>[[Page Name#foo]]</nowiki> from another page.  Up to ten alternate titles can be defined at any call, e.g. <nowiki>{{anchor|foo|bar}}</nowiki> (using more results in an error).


Anchors allow editors to link to a specific part of a page even if there is no section header there.  They can also be useful if an editor wishes to rename a section without breaking all of the links that lead to that section (just drop <nowiki>{{anchor|Old Section Name}}</nowiki> into the header).
Anchors allow editors to link to a specific part of a page even if there is no section header there.  They can also be useful if an editor wishes to rename a section without breaking all of the links that lead to that section (just drop <nowiki>{{anchor|Old Section Name}}</nowiki> into the header).


For more information, see [[wikipedia:Template:Anchor|Template:Anchor on Wikipedia]] (which is the source of this template).
For more information, see [[wikipedia:Template:Anchor|Template:Anchor on Wikipedia]] (which is the source of this template).
</noinclude>
</noinclude>

Revision as of 23:00, 31 December 2012

This template adds an HTML anchor to the page (silently, i.e. without displaying any text in the page's user-facing content). Think of it as a "phantom section" that can be linked to by an internal link containing a pound sign -- e.g. if a page contains {{anchor|foo}}, that part of the page can be linked to by [[#foo]] from the same page, or [[Page Name#foo]] from another page. Up to ten alternate titles can be defined at any call, e.g. {{anchor|foo|bar}} (using more results in an error). Note that they are case-sensitive, and may not like special characters.

Anchors allow editors to link to a specific part of a page even if there is no section header there. They can also be useful if an editor wishes to rename a section without breaking all of the links that lead to that section (just drop {{anchor|Old Section Name}} into the header).

For more information, see Template:Anchor on Wikipedia (which is the source of this template).