SSR and i18n

Signed-off-by: Martin Berg Alstad <git@martials.no>
This commit is contained in:
2024-10-12 18:29:44 +02:00
parent 1a2fec6a59
commit 740cba625d
20 changed files with 273 additions and 62 deletions

View File

@ -0,0 +1,16 @@
---
import { languageTag, type AvailableLanguageTag } from "@/paraglide/runtime"
import { localizePathname, type NavLink } from "@/utils/linking"
import type { ComponentProps } from "@/types/props"
interface Props extends ComponentProps {
to: NavLink
lang?: AvailableLanguageTag
}
const { to, class: clazz, lang = languageTag() } = Astro.props
---
<a href={localizePathname(to, lang)} class={clazz}>
<slot />
</a>