blob: 7ff06a8e6364f3e05618afb4fc8d6332ec8c5a58 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
---
import Footer from '$components/Footer.astro';
import Navbar from '$components/Navbar/Navbar.astro';
import locales, { defaultLocale } from '$i18n/locales';
import translate from '$i18n/translate';
import tFeed from '$i18n/translations/pages/rss.xml';
import site from '$i18n/translations/site';
import { getLocaleFromPathOrDefault } from '$lib/getLocaleFromPath';
import type Locale from '$types/Locale';
interface Props {
title: string;
noBreadcrumbs?: boolean;
}
const { noBreadcrumbs, title } = Astro.props;
const locale = getLocaleFromPathOrDefault(Astro.url.pathname);
const t = translate(locale);
function qualifiedLocalisedPath(newLocale: Locale) {
const localePathSegment = new RegExp(`^/${locale}`);
const localisedPath = Astro.url.pathname.replace(localePathSegment, newLocale);
return Astro.site + localisedPath;
}
---
<!doctype html>
<html lang={locale}>
<head>
<meta charset="UTF-8" />
<meta name="description" content={t(site, { key: 'description' })} />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" href="/favicon.ico" />
<link rel="sitemap" href="/sitemap-index.xml" />
<link rel="stylesheet" href="/css/index.css" />
<link rel="stylesheet" href="/css/index.xs.css" media="(min-width: 16rem)" />
<link rel="stylesheet" href="/css/index.sm.css" media="(min-width: 32rem)" />
<link rel="stylesheet" href="/css/index.md.css" media="(min-width: 48rem)" />
<link rel="stylesheet" href="/css/index.lg.css" media="(min-width: 64rem)" />
<link rel="stylesheet" href="/css/index.xl.css" media="(min-width: 96rem)" />
<link rel="stylesheet" href="/css/index.xl.css" media="(min-width: 120rem)" />
<link
rel="alternate"
type="application/rss+xml"
title={t(tFeed, { key: 'title' })}
href={`/${locale}/rss.xml`}
/>
{
locales.map((locale) => (
<link rel="alternate" href={qualifiedLocalisedPath(locale)} hreflang={locale} />
))
}
<link rel="alternate" href={qualifiedLocalisedPath(defaultLocale)} hreflang="x-default" />
<meta name="generator" content={Astro.generator} />
<title>{title} | {t(site, { key: 'title' })}</title>
</head>
<body id="top">
<a class="btn skip-to-content" href="#main">Skip to content</a>
<Navbar noBreadcrumbs={noBreadcrumbs} />
<slot />
<Footer />
</body>
</html>
|