summaryrefslogtreecommitdiffhomepage
path: root/vhosts/blog/nuldoc-src/components/page_layout.ts
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-01-12 22:17:44 +0900
committernsfisis <nsfisis@gmail.com>2025-01-12 22:17:44 +0900
commitb14dd149e1b5f75bc494623181b19970ef830dec (patch)
treedfff5ee9b9a9e16680fda5cba36e5c817eda1f9e /vhosts/blog/nuldoc-src/components/page_layout.ts
parentaecf316775c995f089012d8fec5c5cc77f6300be (diff)
parent16182acfcc1fad2885b9c1a96fe74d8ce56a50e0 (diff)
downloadnsfisis.dev-b14dd149e1b5f75bc494623181b19970ef830dec.tar.gz
nsfisis.dev-b14dd149e1b5f75bc494623181b19970ef830dec.tar.zst
nsfisis.dev-b14dd149e1b5f75bc494623181b19970ef830dec.zip
Merge branch 'feature/blog-nuldoc-jsx'
Diffstat (limited to 'vhosts/blog/nuldoc-src/components/page_layout.ts')
-rw-r--r--vhosts/blog/nuldoc-src/components/page_layout.ts82
1 files changed, 0 insertions, 82 deletions
diff --git a/vhosts/blog/nuldoc-src/components/page_layout.ts b/vhosts/blog/nuldoc-src/components/page_layout.ts
deleted file mode 100644
index a6b75d01..00000000
--- a/vhosts/blog/nuldoc-src/components/page_layout.ts
+++ /dev/null
@@ -1,82 +0,0 @@
-import { Config } from "../config.ts";
-import { el, Element } from "../dom.ts";
-import { stylesheetLinkElement } from "./utils.ts";
-
-type Params = {
- metaCopyrightYear: number;
- metaDescription: string;
- metaKeywords: string[];
- metaTitle: string;
- metaAtomFeedHref?: string;
- requiresSyntaxHighlight: boolean;
-};
-
-export async function pageLayout(
- {
- metaCopyrightYear,
- metaDescription,
- metaKeywords,
- metaTitle,
- metaAtomFeedHref,
- requiresSyntaxHighlight,
- }: Params,
- body: Element,
- config: Config,
-): Promise<Element> {
- const head = el(
- "head",
- {},
- metaElement({ charset: "UTF-8" }),
- metaElement({
- name: "viewport",
- content: "width=device-width, initial-scale=1.0",
- }),
- metaElement({ name: "author", content: config.blog.author }),
- metaElement({
- name: "copyright",
- content: `&copy; ${metaCopyrightYear} ${config.blog.author}`,
- }),
- metaElement({ name: "description", content: metaDescription }),
- ...(metaKeywords.length === 0 ? [] : [
- metaElement({ name: "keywords", content: metaKeywords.join(",") }),
- ]),
- metaElement({ property: "og:type", content: "article" }),
- metaElement({ property: "og:title", content: metaTitle }),
- metaElement({ property: "og:description", content: metaDescription }),
- metaElement({ property: "og:site_name", content: config.blog.siteName }),
- metaElement({ property: "og:locale", content: "ja_JP" }),
- ...(metaAtomFeedHref
- ? [linkElement("alternate", metaAtomFeedHref, "application/atom+xml")]
- : []),
- linkElement("icon", "/favicon.svg", "image/svg+xml"),
- el("title", {}, metaTitle),
- await stylesheetLinkElement("/style.css", config),
- ...(
- requiresSyntaxHighlight
- ? [await stylesheetLinkElement("/hl.css", config)]
- : []
- ),
- );
- return el(
- "html",
- { lang: "ja-JP" },
- head,
- body,
- );
-}
-
-function metaElement(attrs: Record<string, string>): Element {
- return el("meta", attrs);
-}
-
-function linkElement(
- rel: string,
- href: string,
- type: string | null,
-): Element {
- const attrs: Record<string, string> = { rel: rel, href: href };
- if (type !== null) {
- attrs.type = type;
- }
- return el("link", attrs);
-}