Template:Anchor: Difference between revisions

From CATUG wiki
Jump to navigation Jump to search
(Anchor for hidden links to sections)
 
(clarify)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{#if:{{{1|}}}|<span id="{{{1|}}}"></span>}}<!--
<span id="{{{1}}}"></span><noinclude>
-->{{#if:{{{2|}}}|<span id="{{{2|}}}"></span>}}<!--
 
-->{{#if:{{{3|}}}|<span id="{{{3|}}}"></span>}}<!--
==Documentation==
-->{{#if:{{{4|}}}|<span id="{{{4|}}}"></span>}}<!--
This template creates an anchor. It is useful for maintaining a link to a section where the section title has changed or may be changed in future.
-->{{#if:{{{5|}}}|<span id="{{{5|}}}"></span>}}<!--
 
-->{{#if:{{{6|}}}|<span id="{{{6|}}}"></span>}}<!--
The fixed way to link to a section is by including # between the page name and the section name, so this section right here is:
-->{{#if:{{{7|}}}|<span id="{{{7|}}}"></span>}}<!--
:[[Template:Anchor#Documentation]]
-->{{#if:{{{8|}}}|<span id="{{{8|}}}"></span>}}<!--
 
-->{{#if:{{{9|}}}|<span id="{{{9|}}}"></span>}}<!--
If you want this link to work even after someone might change the heading to something else, insert an anchor like this:  
-->{{#if:{{{10|}}}|<span id="{{{10|}}}"></span>}}<!--
<code><nowiki>{{anchor|Documentation}}</nowiki></code>
-->{{#if:{{{11|}}}|<span class="error">[[Template:Anchor]] (or Anchors): too many anchors, maximum is 10.</span>}}
 
Then another page linking to #Documentation on this page will still go to that anchor on the page, even if the section name changes.
 
 
[[Category:Templates|Anchor]]
 
</noinclude>

Latest revision as of 22:03, 19 October 2011

Documentation

This template creates an anchor. It is useful for maintaining a link to a section where the section title has changed or may be changed in future.

The fixed way to link to a section is by including # between the page name and the section name, so this section right here is:

Template:Anchor#Documentation

If you want this link to work even after someone might change the heading to something else, insert an anchor like this: {{anchor|Documentation}}

Then another page linking to #Documentation on this page will still go to that anchor on the page, even if the section name changes.