--- import { ClientRouter } from 'astro:transitions' import Footer from '../components/Footer.astro' import TopBar from '../components/TopBar.astro' import { localePath, locales, useT, type Locale } from '../i18n/config' import '../styles/global.css' import '../styles/components.css' interface Props { locale: Locale // Subpage slug appended after the locale prefix ('' = home). Drives the // canonical + hreflang URLs so /quiz and /fr/quiz point at themselves. path?: string } const { locale, path = '' } = Astro.props const t = useT(locale) const site = Astro.site! const localeRoot = (l: Locale) => `${localePath(l)}/`.replace('//', '/') const localeHref = (l: Locale) => new URL(path ? `${localeRoot(l)}${path}` : localeRoot(l), site).href const canonical = new URL(localeHref(locale)) const alternates = locales.map((l) => ({ hreflang: l, href: localeHref(l) })) const xDefaultHref = new URL(path ? `/${path}` : '/', site).href --- {t('site.title')} {alternates.map((a) => )}