In this chapter, you’ll learn how to:
- Make an anchor
- Link to an anchor
- Organize your chapter with anchor links
How to Make an Anchor
To make an anchor, place your cursor next to the place in the chapter where you’d like the anchor link to jump to when clicked by a user. Then click the Anchor button on the WYSIWYG Editor. It looks like this:
It will create an anchor field where you’ll type in the name of your anchor. It’s recommended that you make the name something short, contains no spaces, and is descriptive (so it’s easy to remember). For example, to make a series of anchors for this page, I would use make, link, and organize. They’re short and describe the sections of the page.
On the Same Page
Linking to an anchor on the same page is as easy as creating a link in Pressbooks. There is only one extra step. Begin by highlighting the text you want the anchor to link to. (Where you want the user to click to go to the content where the anchor is). Then click the Insert/Edit Link button.
Then you’ll type in the name you gave the anchor in the previous step, proceeded by a hashtag. See below:
On a Different Page
If you want to create an anchor that links back to a different part of the book. You’ll make the anchor in the same way, but when you link to it you’ll want to include a full URL when you insert the link.
You’ll create the link, by highlighting the text and clicking on the link button, then you’ll want to type in the full URL of the chapter you are linking to with the #anchorname you created.
For example, if you were linking the #make anchor we created before on another page, it would look like this:
How to Organize your Book with Anchors
You can also use anchors to organize the content within your Chapters. Using anchors you can build a Table of Contents style navigation section at the top of your chapter. You can see how this works in action in the One Page Organization chapter of this book.
To do so, it’s recommended that you use headings for your sections and then place the anchors next to the section headings, so that they are accessible to readers using a screen reader. See the example below.
- This is an example of an anchor that links to a different page. ↵