Question
How do I manually create anchor links in articles in Zendesk Guide?
Answer
With Guide, you can use the Insert/edit link on the editor's toolbar to add anchors in your articles as described in the article: Inserting and editing links in articles.
When you use this feature, the Heading doesn't appear when the customer selects the anchor link. As a workaround, create the anchor link through the Source code of your article.
To manually create an anchor link
- With the article editor opened, select the Source code </> icon.
- Navigate to the text that you want to target with a link. Insert the code snippet below before the text; this is typically on the same line:
<a name=your_anchor_name></a>
- Enter the desired anchor link name. Here's an example containing an
<a name="section1">
=anchor:
- Link to the anchor by following one of these two options for this.
Option 1
- Select the text you want to use as the link, then click the Insert/edit link icon.
- Select the Heading tab and find the anchor name you added (or the Anchor tab if you see it on your editor version) > select the Anchor of your choice.
- Click Add Link.
Option 2
- In the Source code editor, find the text you want to make into a link. Then, enclose the text in the tag below:
<a href="#your_anchor_name">Link text</a>
In this article's example, we want to make Section I into a link. We changed the code from:
<li>Section I</li>
To:
<li><a href="#section1">Section I</a></li>
Wrap the link text in opening and closing <a> tags, or there won't be anything for the user to select.
The example below shows how the link looks behind the editor before the article is saved:
2. Click OK to save your changes.
If the anchor appears to jump a few lines below the expected location, the toolbar at the top of your screen may interfere. If that is the case, minimize the toolbar and test the anchor link again.
You can also link to an anchor link on another page using the full URL plus the hashtag. For example:
<a href="https://support.zendesk.com/entries/98542436#some_anchor_name"></a>
Using a hashtag without a URL works only if the anchor is on the same page.
If you want the anchor link to go to your header rather than a few lines down, include a few page breaks between the header and the text body.
For more information, see the article: Inserting and editing links in articles.