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
64
65
66
67
68
69
70
71
72
73
74
75
76
|
import { Config } from "../config.ts";
import { elem, Element, Node } from "../dom.ts";
import StaticStylesheet from "./StaticStylesheet.ts";
type Props = {
metaCopyrightYear: number;
metaDescription: string;
metaKeywords?: string[];
metaTitle: string;
metaAtomFeedHref?: string;
requiresSyntaxHighlight?: boolean;
site: "default" | "about" | "blog" | "slides";
config: Config;
children: Node;
};
export default async function PageLayout(
{
metaCopyrightYear,
metaDescription,
metaKeywords,
metaTitle,
metaAtomFeedHref,
requiresSyntaxHighlight: _,
site,
config,
children,
}: Props,
): Promise<Element> {
return elem(
"html",
{ lang: "ja-JP" },
elem(
"head",
{},
elem("meta", { charset: "UTF-8" }),
elem("meta", {
name: "viewport",
content: "width=device-width, initial-scale=1.0",
}),
elem("meta", { name: "author", content: config.site.author }),
elem("meta", {
name: "copyright",
content: `© ${metaCopyrightYear} ${config.site.author}`,
}),
elem("meta", { name: "description", content: metaDescription }),
metaKeywords && metaKeywords.length !== 0
? elem("meta", { name: "keywords", content: metaKeywords.join(",") })
: null,
elem("meta", { property: "og:type", content: "article" }),
elem("meta", { property: "og:title", content: metaTitle }),
elem("meta", { property: "og:description", content: metaDescription }),
elem("meta", {
property: "og:site_name",
content: config.sites[site].siteName,
}),
elem("meta", { property: "og:locale", content: "ja_JP" }),
elem("meta", { name: "Hatena::Bookmark", content: "nocomment" }),
metaAtomFeedHref
? elem("link", {
rel: "alternate",
href: metaAtomFeedHref,
type: "application/atom+xml",
})
: null,
elem("link", {
rel: "icon",
href: "/favicon.svg",
type: "image/svg+xml",
}),
elem("title", {}, metaTitle),
await StaticStylesheet({ fileName: "/style.css", config }),
),
children,
);
}
|