blob: f62a9dc55586536100bbbfc9dc7f51c823559147 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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>
|