2025-03-15 15:34:24 +01:00
|
|
|
---
|
|
|
|
import { type NavLink, resolvePathname } from "@/utils/linking"
|
|
|
|
import LocaleLink from "@/components/links/LocaleLink.astro"
|
|
|
|
|
|
|
|
const pathname = resolvePathname(Astro.originPathname)
|
|
|
|
|
|
|
|
let paths: string[]
|
|
|
|
if (pathname === "/") {
|
|
|
|
paths = ["~"]
|
|
|
|
} else {
|
2025-07-01 19:08:34 +02:00
|
|
|
paths = ["~", ...pathname.split("/").filter(x => x)]
|
2025-03-15 15:34:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function getLink(path: string): NavLink {
|
|
|
|
switch (path) {
|
|
|
|
case "~":
|
|
|
|
return "/"
|
|
|
|
default:
|
|
|
|
return `/${path}` as NavLink
|
|
|
|
}
|
|
|
|
}
|
|
|
|
---
|
|
|
|
|
|
|
|
<div>
|
|
|
|
{
|
|
|
|
paths.map((path, index) => (
|
|
|
|
<span>
|
|
|
|
{index != paths.length - 1 ? (
|
|
|
|
<span>
|
|
|
|
<LocaleLink to={getLink(path)}>{path}</LocaleLink>/
|
|
|
|
</span>
|
|
|
|
) : (
|
|
|
|
path
|
|
|
|
)}
|
|
|
|
</span>
|
|
|
|
))
|
|
|
|
}
|
|
|
|
</div>
|