Skip to content

Commit 5764d4c

Browse files
authored
Merge pull request #889 from reshma045/issue881-branch
Fix: Remove Empty Anchor Link in Jump-To Menu on Reference Pages
2 parents c678a04 + f548f3a commit 5764d4c

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)