Skip to content

Commit 8083af1

Browse files
authored
Merge pull request #962 from processing/pr-889-2.0
Fix: Remove Empty Anchor Link in Jump-To Menu on Reference Pages
2 parents cd295b6 + 1f1437e commit 8083af1

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/layouts/ReferenceLayout.astro

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,12 @@ const jumpCategoryData = categoryData.length === 1
140140
? [...categoryData, ...categoryData[0].subcats]
141141
: categoryData;
142142
143-
const pageJumpToLinks: JumpToLink[] = jumpCategoryData.map((category) => ({
144-
label: category.name as string,
145-
url: `#${category.name}`,
146-
}));
143+
const pageJumpToLinks: JumpToLink[] = jumpCategoryData
144+
.filter((category) => !!category.name) // REMOVE undefined ones
145+
.map((category) => ({
146+
label: category.name as string,
147+
url: `#${category.name}`,
148+
}));
147149
148150
const pageJumpToState: JumpToState = {
149151
links: pageJumpToLinks,

0 commit comments

Comments
 (0)