summaryrefslogtreecommitdiffhomepage
path: root/vhosts/blog/nuldoc-src/components/page_layout.ts
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-01-12 19:43:59 +0900
committernsfisis <nsfisis@gmail.com>2025-01-12 21:37:23 +0900
commit98abcc023b99898f3a7e182e2330ea809a4c99e2 (patch)
treebe8aab31e6185dabac929146426a52dd3b98b26c /vhosts/blog/nuldoc-src/components/page_layout.ts
parentf3a77cb2f83ff2f91a5cc78da2bd735ad0d4edec (diff)
downloadnsfisis.dev-98abcc023b99898f3a7e182e2330ea809a4c99e2.tar.gz
nsfisis.dev-98abcc023b99898f3a7e182e2330ea809a4c99e2.tar.zst
nsfisis.dev-98abcc023b99898f3a7e182e2330ea809a4c99e2.zip
refactor(blog/nuldoc): convert components/*.ts to TSX
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);
-}