-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHead.tsx
61 lines (57 loc) · 1.94 KB
/
Head.tsx
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 { asset, Head } from "$fresh/runtime.ts";
export interface HeadProps {
title?: string;
description?: string;
url?: URL;
imageUrl?: string;
faviconUrl?: string;
styleUrls?: string[];
themeColor?: string;
}
export const defaultProps: HeadProps = {
title: "Deco Live Template Site — edit this!",
description: "A complete digital commerce experience platform.",
url: new URL("https://deco.cx"),
imageUrl: "https://via.placeholder.com/300",
faviconUrl: "",
styleUrls: [],
themeColor: "#003232",
};
export default function HeadComponent(props: HeadProps) {
const merged = { ...defaultProps, ...props };
return (
<Head>
<title>{merged.title}</title>
<meta name="theme-color" content={merged.themeColor}></meta>
<meta name="description" content={merged.description} />
<meta property="og:title" content={merged.title} />
<meta property="og:description" content={merged.description} />
<meta property="og:type" content="website" />
<meta property="og:url" content={merged.url?.href} />
<meta
property="og:image"
content={merged.imageUrl}
/>
<link
rel="shortcut icon"
href={merged.faviconUrl}
type="image/x-icon"
>
</link>
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
</link>
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
</link>
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
</link>
<link rel="manifest" href="/site.webmanifest"></link>
<link rel="mask-icon" href="/safari-pinned-tab.svg" data-color="#003232">
</link>
<meta name="theme-color" content="#003232"></meta>
<meta name="msapplication-TileColor" content="#003232"></meta>
{merged.styleUrls?.map((styleUrl: string) => (
<link rel="stylesheet" href={asset(styleUrl)}></link>
))}
</Head>
);
}