As well as linking to pages, you can also link to specific places within a page. This tutorial shows you how to link to headings and how to create and use anchors...
Creating and Linking to Anchors
Anchors allow you to bookmark specific locations within a page and you can then create links that not only link to the page, but the specific location on it marked by the anchor.
Although there are several automatically generated anchors (such as top/bottom of page and headings) which are discussed later in this tutorial, there will be occasions when you wish to create your own anchors:
{anchor:myAnchor}This won't display anything on your page, but it will insert an invisible anchor that you can then link to as follows:
[#myAnchor] [Jump to Anchor|#myAnchor] [Jump to Anchor|#myAnchor|Jump to my bookmark]If you hover the mouse over the first two links above, you'll see that the automatic tool tip is generally quite helpful as it states both the heading and which page it appears on.
For more information on creating and using anchors, please see our tutorial on the anchor macro.
Linking to Page Headings
Whenever you add Headings to a page, an anchor is automatically created for each heading - this allows you to quickly and easily create links that take the visitor to a specific part of a page. For example, to create a link to the Hints and Tips section near the bottom of this page, the link is added like this:
[#Hints and Tips] [Helpful Hints|#Hints and Tips] [Helpful Hints|#Hints and Tips|Get some hints and tips]You can also link to headings on other pages and even in other spaces, for example:
[Other Link Tutorials|Links#Related Tutorials] [Builder Price Calculator|Builder:About#Why use the Theme Builder plugin?]This essentially links to the specific page and then the heading on that page:
Linking to the Top or Bottom of a Page
If you are using the Builder theme, you can create anchors to the top or bottom of pages as follows...Add this to one of the panels at the top of your layout (eg. header, logo, menu):
{builder-show:context=page}{anchor:top}{builder-show}
And this to one of the panels at the bottom of your layout (eg. footnotes, footer):
{builder-show:context=page}{anchor:bottom}{builder-show}
You can then link to the top or bottom of a current page, using the following notation:
[#top] or [#bottom]
Which results in:
Clicking the links will take you to the top or bottom of the page. As with all links, you can specify alternate on-screen text and also a tooltip:
[Top of Page|#top|Go to the top of the page] or [Bottom of Page|#bottom|Go to the bottom of the page]
You can also link to the top or bottom of other pages, for example:
[Top of Home Page|Home#top|Go to the top of the home page] or [Bottom of Home Page|Home#bottom|Go to the bottom of the home page]
Hints and Tips
When referring to a section (marked by a heading) on a page, always try to use a link that takes the reader to the specific heading so they don't need to read through the preceeding content on the page.
If you want to link to a specific part of a page from an external website, bear in mind that anchor names are prefixed with the page title and some characters may be removed. If you are using the Firefox web browser, you can install the Show Anchors Extension which allows you to quickly display all anchors on a page and copy the anchor links to the clipboard.
Frequently Asked Questions
| Q | I have two headings with the same title on the same page - why can't I link to the second one? |
|---|---|
| A | The automatically generated anchors are based on the text in the headings so if you have more than one heading with the same text you will only be able to link to the first one that appears on the page. If you want to link to the subseqent headings, use the anchor macro to create a custom anchor on the page and link to that instead. |
.png)








Comments (3)
Jan 10, 2007
Anonymous says:
Hi Guys, Top and Bottom anchor links not working in FF2? Just wondered if you ...Hi Guys,
Top and Bottom anchor links not working in FF2? Just wondered if you know.
Guy
Jan 10, 2007
Guy Fraser says:
Ah, sorry about that - it requires the Builder theme and some additional markup ...Ah, sorry about that - it requires the Builder theme and some additional markup has to be added - I've updated the page to include the additional info.
Feb 26, 2011
Klaus Feldmann says:
Could not manage to get toc and toc-zone macros to include anchors too. How can...Could not manage to get toc and toc-zone macros to include anchors too.
How can I create a list of anchors of a current page?