Skip to main content

Anchor links are hyperlinks that send users to specific content on the page that isn't necessarily at the top. Users may be directed to different pages or may create anchor links for traversing content on the same loaded page.

We're using anchor hyperlinks on this page, with the CTA items underneath. In AEM, you can apply anchor links to any hyperlink, button, or CTA.

Introduction

Anchor links are hyperlinks that allow you to link to specific sections on a URL.  We're using them on this page, in the CTA links at the top of this page.  In AEM, you can apply anchor links to any hyperlink, button, or CTA. 

Let's look at how to author an anchor link.

Authoring

An anchor link is configured through two elements:

  • Label: To set up an anchor link you must first add a label to the title of the section you want to link to.
  • Link: Setting up anchor links require some customization to insert the label to your URL.

Adding Labels to Titles

Add a Unique Label

If you are using multiple anchor links on a page, it's important that you take care to give each section a unique label.  Anchor tags will not work if there is more than one label with the same name on a page. 

Adding the Label to a Title

The best practice is to add the label to the Title component of the section you want to link to. This will help you quickly find labels when editing at a later time. 

Once you've planned out your labels for the page, adding it to the title is easy. Just insert your label, in all lowercase, into the ID field of the Title component, as shown here in the image below.