From 0fe11166be24feebc8e5feb77499ae683b0441dd Mon Sep 17 00:00:00 2001 From: gotbadger Date: Fri, 15 Dec 2023 13:14:50 +0000 Subject: [PATCH] doc: fix active page formatting --- docs/.eleventy.js | 12 ++---------- docs/_src/_includes/layouts/doc.njk | 8 +++++++- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/docs/.eleventy.js b/docs/.eleventy.js index 9d99a9ce9..6c27d79e5 100644 --- a/docs/.eleventy.js +++ b/docs/.eleventy.js @@ -180,16 +180,8 @@ module.exports = function (eleventyConfig) { } }) - eleventyConfig.addNunjucksGlobal("navHighlight", (parent, child) => { - const target = parent.split(path.sep).slice(1, -1) - const check = child.split(path.sep).slice(1, -1) - // handles individual rule pages highlighting "rule" in side nav - const isRule = target.includes("rules") - if (child === parent || isRule) { - return true - } else { - return false - } + eleventyConfig.addNunjucksGlobal("navHighlight", (item_url, current_url) => { + return current_url.startsWith(item_url) }) eleventyConfig.addPairedShortcode( diff --git a/docs/_src/_includes/layouts/doc.njk b/docs/_src/_includes/layouts/doc.njk index 3d5ea1be5..7cb376daf 100644 --- a/docs/_src/_includes/layouts/doc.njk +++ b/docs/_src/_includes/layouts/doc.njk @@ -13,7 +13,13 @@ layout: layouts/base.njk