Fork of Chiri for Astro for my blog
1---
2// Import the global.css file here so that it is included on
3// all pages through the use of the <BaseHead /> component.
4import { themeConfig } from '@/config'
5import type { BaseHeadProps } from '@/types/component.types'
6import 'katex/dist/katex.min.css'
7
8const canonicalURL = new URL(Astro.url.pathname, Astro.site)
9
10const { title, description, ogImage, atUri } = Astro.props as BaseHeadProps
11const imageUrl = ogImage ? new URL(ogImage, Astro.url) : new URL('/og/chiri-og.png', Astro.url)
12---
13
14<!-- Global Metadata -->
15<meta charset="utf-8" />
16<meta name="viewport" content="width=device-width,initial-scale=1" />
17<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
18<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
19<link rel="preload" href="/fonts/Inter.woff2" as="font" type="font/woff2" crossorigin="anonymous" />
20<link rel="preload" href="/fonts/Besley-Italic.woff2" as="font" type="font/woff2" crossorigin="anonymous" />
21<link rel="sitemap" href="/sitemap-index.xml" />
22<link rel="alternate" type="application/rss+xml" title={themeConfig.site.title} href={new URL('rss.xml', Astro.site)} />
23<meta name="generator" content={Astro.generator} />
24
25<!-- Canonical URL -->
26<link rel="canonical" href={canonicalURL} />
27
28{atUri && <link rel="site.standard.document" href={atUri} />}
29
30<!-- Primary Meta Tags -->
31<title>
32 {title || themeConfig.site.title}
33</title>
34<meta name="title" content={title} />
35<meta name="description" content={description} />
36
37<!-- Open Graph / Facebook -->
38<meta property="og:type" content="website" />
39<meta property="og:url" content={Astro.url} />
40<meta property="og:title" content={title} />
41<meta property="og:description" content={description} />
42<meta property="og:image" content={imageUrl} />
43
44<!-- Twitter -->
45<meta property="twitter:card" content="summary_large_image" />
46<meta property="twitter:url" content={Astro.url} />
47<meta property="twitter:title" content={title} />
48<meta property="twitter:description" content={description} />
49<meta property="twitter:image" content={imageUrl} />
50
51<!-- Google tag (gtag.js) -->
52<script async src="https://www.googletagmanager.com/gtag/js?id=G-QG1BRT6R0V"></script>
53<script>
54 // @ts-nocheck
55 window.dataLayer = window.dataLayer || [];
56 function gtag(){dataLayer.push(arguments);}
57 gtag('js', new Date());
58
59 gtag('config', 'G-QG1BRT6R0V');
60</script>