mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2025-04-28 19:43:31 +08:00
Merge 899c0a5bb9
into 9e6b7b22a9
This commit is contained in:
commit
1fe835ecc3
@ -32,10 +32,12 @@ function buildIdToNavigationElementMap(navigation: NodeListOf<Element>): IdToEle
|
|||||||
const sectionLinkRef: IdToElementMap = {};
|
const sectionLinkRef: IdToElementMap = {};
|
||||||
navigation.forEach((navigationElement: HTMLElement) => {
|
navigation.forEach((navigationElement: HTMLElement) => {
|
||||||
const link = navigationElement.querySelector("a");
|
const link = navigationElement.querySelector("a");
|
||||||
|
if (link) {
|
||||||
const href = link.getAttribute("href");
|
const href = link.getAttribute("href");
|
||||||
if (href.startsWith("#")) {
|
if (href.startsWith("#")) {
|
||||||
sectionLinkRef[href.slice(1)] = navigationElement;
|
sectionLinkRef[href.slice(1)] = navigationElement;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return sectionLinkRef;
|
return sectionLinkRef;
|
||||||
|
Loading…
Reference in New Issue
Block a user