Correctly highlight level 1 empty navs

This commit is contained in:
Florine W. Dekker 2021-03-27 21:51:19 +01:00
parent 543f65675d
commit e4e5193b70
Signed by: FWDekker
GPG Key ID: B1B567AF58D6EE0F
1 changed files with 1 additions and 1 deletions

View File

@ -87,7 +87,7 @@ const unpackEntry = function (entry, path = "/", highlightPath = "") {
const shouldHighlight = highlightPath.startsWith(`${path + entry.name}/`);
if (entry.entries.length === 0)
return `<li><a href="${entry.link}" class="${shouldHighlight ? "currentPage" : ""}">${entry.name}</a></li>`;
return `<li class="${shouldHighlight ? "currentPage" : ""}"><a href="${entry.link}">${entry.name}</a></li>`;
const depth = path.split("/").length - 2; // -1 because count parts, then another -1 because of leading `/`
const arrow = depth === 0 ? "&#9662;" : "&#9656;";