Difference between revisions of "Anchors - Mediawiki"
(→Manual anchors) |
|||
Line 2: | Line 2: | ||
Anchors allow you to link to a specific portion of a page. | Anchors allow you to link to a specific portion of a page. | ||
− | ==Setting anchors== | + | ===Setting anchors=== |
− | ===Automatic anchors=== | + | ====Automatic anchors==== |
Section headings automatically act as anchors, with the heading text as the "anchor_name". In the case of multiple sections with identical headings, the anchor name of each has "_2", "_3", etc. appended, starting from the second occurrence. | Section headings automatically act as anchors, with the heading text as the "anchor_name". In the case of multiple sections with identical headings, the anchor name of each has "_2", "_3", etc. appended, starting from the second occurrence. | ||
− | ===Using the <nowiki>{{anchor}}</nowiki> template=== | + | ====Using the <nowiki>{{anchor}}</nowiki> template==== |
#set your anchor anywhere in the page by using | #set your anchor anywhere in the page by using | ||
<pre>{{anchor|anchorname}}</pre> | <pre>{{anchor|anchorname}}</pre> | ||
− | ===Manual anchors=== | + | ====Manual anchors==== |
Manually-set anchors are useful for linking to "unlinkable" things like a table (title or cell), a section of plain text, etc. | Manually-set anchors are useful for linking to "unlinkable" things like a table (title or cell), a section of plain text, etc. | ||
There are a number of ways to set an anchor at an arbitrary position: | There are a number of ways to set an anchor at an arbitrary position: | ||
Line 20: | Line 20: | ||
* On some wikis, a [[Templates - Mediawiki|template]] called "anchor" exists, providing a simple, standardized method for that wiki. The Self Study wiki does use [[Template:Anchor]]. | * On some wikis, a [[Templates - Mediawiki|template]] called "anchor" exists, providing a simple, standardized method for that wiki. The Self Study wiki does use [[Template:Anchor]]. | ||
− | ==Referencing anchors== | + | ===Referencing anchors=== |
Inside a regular wiki link <nowiki>[[page#anchor_name|shows_as]]</nowiki>, include the hash sign (#) and the header name or the id tag name as you have written it. | Inside a regular wiki link <nowiki>[[page#anchor_name|shows_as]]</nowiki>, include the hash sign (#) and the header name or the id tag name as you have written it. | ||
Revision as of 15:58, 3 December 2010
Anchors allow you to link to a specific portion of a page.
Setting anchors
Automatic anchors
Section headings automatically act as anchors, with the heading text as the "anchor_name". In the case of multiple sections with identical headings, the anchor name of each has "_2", "_3", etc. appended, starting from the second occurrence.
Using the {{anchor}} template
- set your anchor anywhere in the page by using
{{anchor|anchorname}}
Manual anchors
Manually-set anchors are useful for linking to "unlinkable" things like a table (title or cell), a section of plain text, etc. There are a number of ways to set an anchor at an arbitrary position:
- Generic anchor:
<span id="anchor_name">some text</span>
. For a hidden anchor, omit the text.
- The reserved name
[[#top]]
always links to the top of a page.
- On some wikis, a template called "anchor" exists, providing a simple, standardized method for that wiki. The Self Study wiki does use Template:Anchor.
Referencing anchors
Inside a regular wiki link [[page#anchor_name|shows_as]], include the hash sign (#) and the header name or the id tag name as you have written it.
Links of the form [[#anchor_name]]
will link to the first anchor on the page matching that "anchor_name", usually the first identical section heading.
- See also