RapidWeaver FAQ - Anchors







Share/Bookmark


On one of my pages I would like to add a page-internal link. A link to a spot on the same page. How can I do that in RapidWeaver?


Those links are called anchors.

Chapter 1: What is an Anchor?
Chapter 2: How can I add Anchors to RapidWeaver?
Chapter 3: How can I add “Back to the top” links in RapidWeaver?
Chapter 4: Linking to a specific part of the page from another page



Chapter 1: What is an Anchor?


An anchor is a link which points to a part of the same page the link is added to.

Say you have a page which is full of text and divided into chapters. You want to have an index of the chapters at the top of the page and when someone clicks on a link in that chapter index you want him to be taken directly to the chapter he wanted to read. Or you want to link to a specific part of a page from another page. How can you achieve that? That’s what anchors are used for... Try it by clicking on this link which will take you straight to
Chapter 3

Chapter 2: How can I add Anchors to RapidWeaver?


For an anchor to work you need two things. First is a link pointing to the anchor like

http://yourdomain.com/sitename/pagename.html#1

and second is the target hence where you want people to be taken to when clicking on the link. This is defined by the following code

<a name="1"></a>



which needs to be placed where you want people to be taken to when clicking on the link. The 1 stands for the name of the anchor. I always use 1 for chapter 1, 2 for chapter 2, 3 for chapter 3, ... But you could also use a keyword like languages if you want

http://yourdomain.com/sitename/pagename.html#languages

<a name="languages"></a>



I would recommend you to use 1, 2, 3, ... because it's easier.

1. Write the content of the page where you want to have Anchors

2. Make the links, as you always do, pointing to the anchors. Write the text for the link and select it, Add link

http://yourdomain.com/sitename/pagename.html#1

for Chapter 1

http://yourdomain.com/sitename/pagename.html#2

for Chapter 2 and so on...

Replacing http://yourdomain.com/sitename/pagename.html with the URL of the page you want to have anchors on. Once you have the URL of the page add #1 for the link pointing to chapter 1, #2 for chapter 2, #3 for chapter 3, ... as in the examples above (# is done by hitting alt/option and 3 on your keyboard).

Example: Towards the top of this Anchors FAQ page I made a link linking to:
http://rapidweaverfaq.org/site/anchors.html#3 for Chapter 3

3. Now you need to add the anchor code to the page where you want people to be taken to when clicking the appropriate link. A few lines above the start of the chapter of interest or at the end of the chapter preceding the chapter of interest add

<a name="1"></a>


4. Once you added the code to RapidWeaver select it and go to "Format", "HTML" choose "Code".

Chapter 3: How can I add “Back to the top” links in RapidWeaver?


Especially when pages are long it is recommended to add a link which goes back to the top so that people don’t have to scroll the whole way up again. To add a “Back to the top” link in RapidWeaver add the following code at the top of the page (first line).

<a name="top"></a>



and where you want the link to display add

<a href="#top">Back to the top</a>



of course you can also add the back to the top link more than once on the same page if you want.


Chapter 4: Linking to a specific part of the page from another page


To link to a specific part of the page from another page simply use make a link as we did for the index...

http://yourdomain.com/sitename/pagename.html#3

Example:
http://rapidweaverfaq.org/site/anchors.html#3


This FAQ is also discussed in my RapidWeaverFAQ.org E-Book (sample)

RapidWeaverFAQ.org - Tutorials, Tips & Tricks is made with RapidWeaver and for RapidWeaver.
It's an EBookStoreToday.com company. It's presented by Cédric Giger and hosted by HostGator.com

Thank you for visiting and supporting my website,
- Cédric -


Now share it…

Share