From 98abcc023b99898f3a7e182e2330ea809a4c99e2 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 12 Jan 2025 19:43:59 +0900 Subject: refactor(blog/nuldoc): convert components/*.ts to TSX --- vhosts/blog/nuldoc-src/components/page_layout.ts | 82 ------------------------ 1 file changed, 82 deletions(-) delete mode 100644 vhosts/blog/nuldoc-src/components/page_layout.ts (limited to 'vhosts/blog/nuldoc-src/components/page_layout.ts') 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 { - 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: `© ${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): Element { - return el("meta", attrs); -} - -function linkElement( - rel: string, - href: string, - type: string | null, -): Element { - const attrs: Record = { rel: rel, href: href }; - if (type !== null) { - attrs.type = type; - } - return el("link", attrs); -} -- cgit v1.2.3-70-g09d2