-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLayout.astro
More file actions
61 lines (56 loc) · 1.98 KB
/
Layout.astro
File metadata and controls
61 lines (56 loc) · 1.98 KB
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
---
import "@t-req/ui/fonts";
import "../styles/global.css";
interface Props {
title?: string;
description?: string;
ogDescription?: string;
twitterDescription?: string;
ogImage?: string;
canonicalUrl?: string;
}
const {
title = "t-req",
description = "t-req is a utility-first API client with .http files that integrate with Vitest, Jest, and Bun.",
ogDescription,
twitterDescription,
ogImage = "/logo.jpg",
canonicalUrl,
} = Astro.props;
const canonicalHref =
canonicalUrl ??
(Astro.site ? new URL(Astro.url.pathname, Astro.site).href : undefined);
const socialDescription = ogDescription ?? description;
const twitterSocialDescription = twitterDescription ?? socialDescription;
const ogImageUrl = (() => {
if (!ogImage) return undefined;
if (ogImage.startsWith("http://") || ogImage.startsWith("https://"))
return ogImage;
return Astro.site ? new URL(ogImage, Astro.site).href : ogImage;
})();
---
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content={description} />
{canonicalHref && <link rel="canonical" href={canonicalHref} />}
<meta property="og:title" content={title} />
<meta property="og:description" content={socialDescription} />
<meta property="og:type" content="website" />
{canonicalHref && <meta property="og:url" content={canonicalHref} />}
{ogImageUrl && <meta property="og:image" content={ogImageUrl} />}
<meta property="og:site_name" content="t-req" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content={title} />
<meta name="twitter:description" content={twitterSocialDescription} />
{ogImageUrl && <meta name="twitter:image" content={ogImageUrl} />}
<link rel="icon" type="image/png" href="/favicon.png" />
<link rel="apple-touch-icon" href="/favicon.png" />
<title>{title}</title>
</head>
<body>
<slot />
</body>
</html>