aboutsummaryrefslogtreecommitdiff
path: root/apps/website/src/components/shared/BaseHead.astro
blob: 4c878dda2dcdea2b66cff2af36834531f29ae4f2 (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
---
import smartypants from 'smartypants';
import siteInfo from '../../data/site-info';
import FontPreload from './FontPreload.astro';
import SEO from './SEO.astro';
import Favicon from '/media/polyfrost/minimal_bg.svg?url';

export type Props = {
	title?: string;
	description?: string;
	image?: { src: string; alt: string };
	canonicalURL?: URL | null;
	pageType?: 'website' | 'article';
};

const twitterHandle = 'polyfrost';

const {
	description = siteInfo.description,
	image = siteInfo.image,
	canonicalURL = new URL(Astro.request.url, Astro.site),
	pageType = 'website',
} = Astro.props;

const title = [Astro.props.title, siteInfo.name].filter(Boolean).join(' | ');
const resolvedImage = {
	src: new URL(image.src, Astro.site).toString(),
	alt: image.alt,
};
---

<!-- High Priority Global Metadata -->
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title set:html={smartypants(title, 1)} />
<meta name="generator" content={Astro.generator} />

<!-- Font Preloads -->
<FontPreload />

<!-- Low Priority Global Metadata -->
<link rel="icon" type="image/svg+xml" href={Favicon}/>
<link rel="sitemap" href="/sitemap-index.xml" />
<link rel="mask-icon" href="/media/polyfrost/minimal_bg.svg" />
<link rel="alternate" type="application/rss+xml" href="/rss.xml" title="RSS" />

<SEO
	name={siteInfo.name}
	title={title}
	description={description}
	image={resolvedImage}
	twitter={{ handle: twitterHandle }}
	og={{ type: pageType }}
	canonicalURL={canonicalURL}
/>