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"
, thehidden
attribute or the.visuallyhidden
class - where a heading has an ancestor carrying the attribute
data-anchor="no"
, thehidden
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: