Skip to content

Commit b3b86c2

Browse files
authored
Only use English slug if one exists (github#28399)
1 parent d66bc57 commit b3b86c2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/render-content/plugins/use-english-headings.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ export default function useEnglishHeadings({ englishHeadings }) {
1919
// get English slug
2020
const englishSlug = slugger.slug(englishHeading)
2121
// use English slug for heading ID and link
22-
node.properties.id = englishSlug
22+
if (englishSlug) {
23+
// only use English slug if there is one, otherwise we'll end up with
24+
// empty IDs
25+
node.properties.id = englishSlug
26+
}
2327
})
2428
}
2529
}

0 commit comments

Comments
 (0)