Highlight logo if on main page

This commit is contained in:
Florine W. Dekker 2022-11-24 17:49:22 +01:00
parent 2e33b8d762
commit a208f13f4e
Signed by: FWDekker
GPG Key ID: D3DCFAA8A4560BE0
2 changed files with 6 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@fwdekker/template",
"version": "3.3.6",
"version": "3.3.7",
"description": "The base template for pages on fwdekker.com.",
"author": "Florine W. Dekker",
"license": "MIT",

View File

@ -86,7 +86,11 @@ function nav(highlightPath?: string, cb?: (json: any) => void): HTMLElement {
const checkbox = stringToHtml(`<input id="fwd-nav-hamburger-checkbox" type="checkbox" hidden />`);
nav.appendChild(checkbox);
const base = stringToHtml(`<ul><li><a id="logo" href="https://fwdekker.com/">FWDekker</a></span></li></ul>`);
const base = stringToHtml(
`<ul><li ${highlightPath === "/" ? `class="fwd-nav-highlighted" aria-current="page"` : ""}>` +
`<a id="logo" href="https://fwdekker.com/">FWDekker</a>` +
`</li></ul>`
);
fetch("https://fwdekker.com/api/nav/")
.then(it => it.json())
.then(json => {