Question

How do I manually create anchor links in articles?

Answer

In Knowledge, use the Link button on the editor toolbar to add anchors to your articles as described in Inserting and editing links in articles.

When you use this feature, the section title does not appear when the customer selects the anchor link. As a workaround, create the anchor link in the Source code of your article.

To manually create an anchor link:

In the article editor, select the HTML or Source code icon

Go to the target text and insert the code snippet below before the text on the same line:

id="your_anchor_name">

Enter the anchor name, for example: id="your_anchor_name">

Link to the anchor in one of these two ways

Option 1:

Select the text to use as the link, then click the Link icon

Select the Heading tab and find the anchor name you added (or the Anchor tab in your editor). Select the anchor.

Click Add Link

Option 2:

In the Source code editor, find the text you want to turn into a link. Enclose the text in the tag below and point to the id of your anchor target:

<a href="#your_anchor_name">Link text</a>

In the example below, the goal is to make Section I into a link.

First, set an anchor target by giving the section title a unique id attribute:

<h2 id="section1">Section I</h2>

Then, change the link code from:

<li>Section I</li>

To:

<li><a href="#section1">Section I</a></li>

Wrap the link text in <a> tags so the user can select it.

The example below shows how the link looks in the editor before you save the article:

2. Click Apply to save your changes

If the anchor jumps a few lines below the expected location, the toolbar at the top of your screen may interfere. If that's the case, minimize the toolbar and test the anchor link again.

You can also link to an anchor target on another page. Use the full URL plus the # sign and the id value of the anchor. For example:

<a href="https://support.zendesk.com/articles/98542436#some_anchor_name"></a>

Example help center URL: https://yoursubdomain.zendesk.com/hc/en-us/articles/123456#some_anchor_name

Use only the # sign (for example, href="#section1") if the anchor target is on the same page. If the target is on a different page, include the full URL first, then #id_value.

To move the anchor link to the section title instead of a few lines below, add a few page breaks between the section title and the body text.

For more information, see Inserting and editing links in articles.