Browse Source

Correctly highlight level 1 empty navs

master v0.0.25
F.W. Dekker 8 months ago
parent
commit
e4e5193b70
Signed by: FWDekker GPG Key ID: B1B567AF58D6EE0F
  1. 2
      src/main/js/Template.js

2
src/main/js/Template.js

@ -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;";

Loading…
Cancel
Save