From 78e3e234877cb10ca1088df31e831b36fa4a12c0 Mon Sep 17 00:00:00 2001 From: Yuqian Yang Date: Fri, 23 Jan 2026 23:16:45 +0800 Subject: HALF WORK! --- www-2/src/components/Nav.astro | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 www-2/src/components/Nav.astro (limited to 'www-2/src/components/Nav.astro') diff --git a/www-2/src/components/Nav.astro b/www-2/src/components/Nav.astro new file mode 100644 index 0000000..f62a9dc --- /dev/null +++ b/www-2/src/components/Nav.astro @@ -0,0 +1,23 @@ +--- + +let path = Astro.url.pathname +if (path.startsWith("/")) { path = path.slice(1)} +if (path.endsWith("/")) { path = path.slice(0, -1)} +const segments = path.split("/").slice(0, -1); +const sections: {name: string; link: string;}[] = [] +let current = "/" +for (const segment of segments) { + current += segment + "/"; + sections.push({ + name: segment, + link: current + }) +} + +--- + -- cgit v1.2.3