Skip to content

Commit dc6245c

Browse files
Update docs for headings anchors script re: manually excluded items
1 parent 93324ee commit dc6245c

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

docs/scripts/heading-anchors.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,19 @@
33
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 within the `<main>` element, with the following exclusions:
44

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

99
If a heading already has an `id` attribute, this is used when creating the `href` for the `<a>`. Otherwise, the script parses the text content of the heading to create both the heading `id` and the anchor `href`.
1010

11-
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).
11+
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).
12+
13+
The `data-anchor="no"` attribute has been added directly to the markup to override this behaviour in the following places:
14+
15+
- [home page template](../templates/home.md)
16+
- [people listing](../templates/listings.md#list-of-people)
17+
- [cards used for events listings](../templates/listings.md#list-of-events)
18+
- [collapsible containers](../components/collapsible-containers.md)
19+
- [evangelists](../components/evangelists.md)
20+
- [group list](../components/group-list.md)
21+
- [notes](../components/notes.md)

0 commit comments

Comments
 (0)