From 571edfcf00dc0eacc5678fde079d0139ee03a198 Mon Sep 17 00:00:00 2001 From: Oliver Bryan <04oliverbryan@gmail.com> Date: Sun, 28 Sep 2025 21:38:27 +0100 Subject: [PATCH] improved current page handling --- src/components/Header.astro | 46 +++++++++++++++++++++++++++++--- src/components/NavLink.astro | 2 +- src/components/ProjectPage.astro | 7 ++++- src/pages/about.astro | 2 +- src/pages/index.astro | 2 +- 5 files changed, 51 insertions(+), 8 deletions(-) diff --git a/src/components/Header.astro b/src/components/Header.astro index 3919b6c3..c6a63224 100644 --- a/src/components/Header.astro +++ b/src/components/Header.astro @@ -2,15 +2,53 @@ import NavLink from "./NavLink.astro"; const { currentPage } = Astro.props; + +const pages = [ + { title: "Home", path: "/" }, + { title: "About", path: "/about" }, +]; --- + +

oliver bryan

- -
- - +
+ { + pages.map((page) => ( + + )) + } + + { + !pages.find((page) => page.path === currentPage.path) && ( + + | {currentPage.path} + + + ) + }
diff --git a/src/components/NavLink.astro b/src/components/NavLink.astro index 6db11ad3..a44c8cd8 100644 --- a/src/components/NavLink.astro +++ b/src/components/NavLink.astro @@ -13,6 +13,6 @@ const { currentPage, title, href } = Astro.props; {title} diff --git a/src/components/ProjectPage.astro b/src/components/ProjectPage.astro index fd2c0508..ef45abda 100644 --- a/src/components/ProjectPage.astro +++ b/src/components/ProjectPage.astro @@ -32,7 +32,12 @@ const { metadata } = Astro.props; } - +

{metadata.title} diff --git a/src/pages/about.astro b/src/pages/about.astro index dc2b5923..31a50bcd 100644 --- a/src/pages/about.astro +++ b/src/pages/about.astro @@ -3,7 +3,7 @@ import Layout from "../layouts/Layout.astro"; import TimeSince from "../components/TimeSince.astro"; --- - +

AGE: parseDate(b.date).getTime() - parseDate(a.date).getTime()); --- - +