Skip to content
Design System
  • Home
  • Settings
  • Styles
  • Layouts
  • Components
  • Scripts
  • Templates
  • Heading anchors

Heading anchors

This script is part of main.js/main.min.js. To help linking to specific parts of pages, this script automatically creates and appends a visible anchor link to the end of any H2-H6 heading that have an id attribute within the <main> element, with the following exclusions:

  • where the heading is a child of a <nav> element
  • where the heading carries the attribute data-anchor="no", the hidden attribute or the .visuallyhidden class
  • where a heading has an ancestor carrying the attribute data-anchor="no", the hidden attribute or the .visuallyhidden class

The id attribute is used when creating the href for the <a>.

To override the default behaviour of the script and prevent the addition of anchor links to headings, modify the HTML markup to apply the data-anchor="no" attribute to an individual heading (or to a parent container, if targeting a group of headings).

The data-anchor="no" attribute has been added directly to the markup to override this behaviour in the following places:

  • home page template
  • people listing
  • cards used for events listings
  • collapsible containers
  • evangelists
  • group list
  • notes

Copyright © 2025 W3C - generated 10 Jan 2025, 12:43:28 UTC

Feedback is welcome and can be submitted as a GitHub issue.