Template:AnchorLink

From Cassette Beasts
Revision as of 17:37, 8 December 2024 by Mezzodrinker (talk | contribs) (Created page with "<includeonly><onlyinclude>[[{{{page|}}}#{{anchorencode:{{{1}}}}}{{#if: {{{2|}}}|{{!}}{{{2}}}}}]]</onlyinclude></includeonly>The '''{{PAGENAME}}''' template is the counterpart...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The AnchorLink template is the counterpart to Template:Anchor, and allows you to link to an anchor previously defined using Template:Anchor and even section headings with ease.

Parameters

1
Name of the anchor. Will be encoded into an anchor string using the {{anchorencode:}} magic word].
2
(optional)
The link text. While technically optional, not specifying it will make the resultant link look a bit odd.
page
(optional, defaults to current page)
The wiki page on which the anchor can be found.

Usage

To link to an anchor created with {{Anchor|My custom anchor}}, you can simply use {{AnchorLink|My custom anchor}}, which will produce a link that looks like this:

#My_custom_anchor

To specify a custom link text, you can simply add the second parameter, for example {{AnchorLink|My custom anchor|Link to my custom anchor}}:

Link to my custom anchor