Create anchor links for fast navigation
Anchor links allow readers to jump to a specific part of the page. If your article is really long or text-heavy, consider creating a table of contents or index using anchor links for quick navigation. This article will teach you how to insert anchor links in the Docs editor.
In this article
Adding an anchor ID to header elements
In the example below, clicking on the Add new User accounts link will automatically send the reader to the Add new User accounts heading. To make this connection, we need to give the heading an ID in the HTML editor.
Toggle the HTML editor by clicking the </> icon on the toolbar. Here's what our header (h3 in this case) looks like with an ID attached:
<h3 id="new">Add new User accounts</h3>
Creating the anchor link
With the header ID in place, complete the anchor connection by adding a link to that header:
- Highlight the text that should link to the header anchor.
- Click the link icon in the toolbar and select the Insert link option from the dropdown menu.
- Add your ID with a preceding # symbol in to the URL field. For our example above, it would look like this: #new
- Click the blue Insert button when you're finished.
Here's what the finished anchor looks like in the HTML editor:
<a href="#new">Add new User accounts</a>
Make sure to preview the article to test your anchor links before publishing.