Template:Anchor/doc: Difference between revisions

From Portals of Phereon Wiki
Content added Content deleted
portalsofphereon>Olaroll
(Created page with "This template manually adds one or more HTML anchors (i.e., link targets) to a page. This allows incoming links to target locations on the page other than section headings. ...")
m (1 revision imported)
Line 1:
{{doc/start}}
This template manually adds one or more HTML anchors (i.e., link targets) to a page. This allows incoming links to target locations on the page other than section headings.
Anchors are "jump points". Place them somewhere on a page and you will be able to link to that section of the page directly. Without the use of ==sections/headings/titles==.
 
==Usage==
{{t|anchor|target}}
<nowiki>{{</nowiki>Anchor|''Anchor ID''}}
{{t|anchor|target|Target|TARGET}}
 
*''Anchor ID'' is the text after the # character that you would like to be used in a link.
This allows links of the form <code><nowiki>[[#target]]</nowiki></code> to be used on the same page and links of the form <code><nowiki>[[Page title#target]]</nowiki></code> to be used on a different page (assuming "Page title" is the title of the page this template is used on).
*These anchors are invisible.
 
==How to link to anchors==
The second example usage shows how multiple anchors can be provided within a single template call. It also illustrates how capitalization differences are significant in HTML anchor names; for this reason, if you suspect that incoming links will try to use targets with different capitalization (or punctuation, whitespace, etc.), then all allowed forms must be explicitly listed in the template call.
As an example, if you placed <nowiki>{{</nowiki>Anchor|Foo}} on the [[Sandbox]] page, you could use <nowiki>[[</nowiki>Sandbox#Foo]] as a link that jumps to it.
 
{{doc/end}}
Up to 10 targets can be specified in a single template call, otherwise an error message will be displayed (this message may break the page layout) and the current page will be listed in the error-tracking <span class="plainlinks">[{{fullurl:Category:Template errors}} Category:Template errors]</span> (this maintenance category should remain empty and does not need to be created). If more anchors are are needed, a second template call can immediately follow the first one.
<includeonly>[[Category:Templates|{{PAGENAME}}]]</includeonly><noinclude>[[Category:Template documentation|{{PAGENAME}}]]</noinclude>

Revision as of 12:34, 1 December 2019

This is a documentation subpage for Template:Anchor.
It contains usage information, categories and other content that is not part of the original template page.

Anchors are "jump points". Place them somewhere on a page and you will be able to link to that section of the page directly. Without the use of ==sections/headings/titles==.

Usage

{{Anchor|Anchor ID}}

  • Anchor ID is the text after the # character that you would like to be used in a link.
  • These anchors are invisible.

How to link to anchors

As an example, if you placed {{Anchor|Foo}} on the Sandbox page, you could use [[Sandbox#Foo]] as a link that jumps to it.