diff --git a/config/filters/navigation.js b/config/filters/navigation.js index efff24f..137b5dc 100644 --- a/config/filters/navigation.js +++ b/config/filters/navigation.js @@ -1,4 +1,12 @@ +const normalizeUrl = (url) => + url.replace(/index\.php$|index\.html$/i, '').replace(/\.php$|\.html$/i, '') || '/'; + export default { - isLinkActive: (category, page) => - page.includes(category) && page.split('/').filter((a) => a !== '').length <= 1 + isLinkActive: (category, page) => { + const normalized = normalizeUrl(page); + return ( + normalized.includes(category) && normalized.split('/').filter((a) => a !== '').length <= 1 + ); + }, + normalizeUrl }; diff --git a/package-lock.json b/package-lock.json index c93983b..345cee1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "coryd.dev", - "version": "10.6.4", + "version": "10.6.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "coryd.dev", - "version": "10.6.4", + "version": "10.6.5", "license": "MIT", "dependencies": { "minisearch": "^7.1.2", diff --git a/package.json b/package.json index 274dc22..e742470 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coryd.dev", - "version": "10.6.4", + "version": "10.6.5", "description": "The source for my personal site. Built using 11ty (and other tools).", "type": "module", "engines": { diff --git a/src/includes/static/layout/header.liquid b/src/includes/static/layout/header.liquid index e15f394..4c0fc42 100644 --- a/src/includes/static/layout/header.liquid +++ b/src/includes/static/layout/header.liquid @@ -1,3 +1,4 @@ +{%- assign normalizedUrl = page.url | normalizeUrl -%} {%- capture headerContent -%}

- {%- if page.url == "/" -%} + {%- if normalizedUrl == "/" -%} {{ headerContent }} {%- else -%} {{ headerContent }}