From 4a2baa8dcd4fc7a56783bfee64557423bf23ed82 Mon Sep 17 00:00:00 2001 From: Kuba Orlik Date: Tue, 26 Dec 2023 10:50:42 +0100 Subject: [PATCH] Make active links in sidebar disabled --- src/back/routes/common/navbar.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/back/routes/common/navbar.ts b/src/back/routes/common/navbar.ts index ccdce6c..445f6f8 100644 --- a/src/back/routes/common/navbar.ts +++ b/src/back/routes/common/navbar.ts @@ -15,7 +15,11 @@ export default async function navbar(ctx: BaseContext) { ]; const linksHTML = linkData - .map((link) => `
  • ${link.text}
  • `) + .map((link) => + link.url === new URL(ctx.url, "https://a.com").pathname + ? `
  • ${link.text}
  • ` + : /* HTML */ `
  • ${link.text}
  • ` + ) .join("\n"); return /* HTML */ `