diff options
| author | Yuqian Yang <crupest@crupest.life> | 2026-01-23 23:16:45 +0800 |
|---|---|---|
| committer | Yuqian Yang <crupest@crupest.life> | 2026-01-23 23:16:45 +0800 |
| commit | 78e3e234877cb10ca1088df31e831b36fa4a12c0 (patch) | |
| tree | a4b86275895b33d47df4686e5ce8f98b57016f90 /www-2/src/components/Nav.astro | |
| parent | 3af5ef00b38c6962c6e3f63add0312fa6537b74b (diff) | |
| download | crupest-78e3e234877cb10ca1088df31e831b36fa4a12c0.tar.gz crupest-78e3e234877cb10ca1088df31e831b36fa4a12c0.tar.bz2 crupest-78e3e234877cb10ca1088df31e831b36fa4a12c0.zip | |
HALF WORK!
Diffstat (limited to 'www-2/src/components/Nav.astro')
| -rw-r--r-- | www-2/src/components/Nav.astro | 23 |
1 files changed, 23 insertions, 0 deletions
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 + }) +} + +--- +<nav class="mono"> + { sections.map(s => + <><a class="mono-link" href={s.link}>{s.name}</a> ></>) + } + this +</nav> |
