aboutsummaryrefslogtreecommitdiffhomepage
path: root/nuldoc-src/templates/about.ts
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2023-03-17 01:03:59 +0900
committernsfisis <nsfisis@gmail.com>2023-03-17 01:03:59 +0900
commitee72f8780cf3681e4202cc3a6358fb4038db1ec8 (patch)
treebb3b375339757f4677df03ea4d06268e18ae8de5 /nuldoc-src/templates/about.ts
parentf5b1c4d1429356ebcef2a8cdd7b5d311a9477a6c (diff)
downloadblog.nsfisis.dev-ee72f8780cf3681e4202cc3a6358fb4038db1ec8.tar.gz
blog.nsfisis.dev-ee72f8780cf3681e4202cc3a6358fb4038db1ec8.tar.zst
blog.nsfisis.dev-ee72f8780cf3681e4202cc3a6358fb4038db1ec8.zip
feat(nuldoc): implement /about/ page (work in progress)
Diffstat (limited to 'nuldoc-src/templates/about.ts')
-rw-r--r--nuldoc-src/templates/about.ts123
1 files changed, 123 insertions, 0 deletions
diff --git a/nuldoc-src/templates/about.ts b/nuldoc-src/templates/about.ts
new file mode 100644
index 0000000..c41418c
--- /dev/null
+++ b/nuldoc-src/templates/about.ts
@@ -0,0 +1,123 @@
+import { Element } from "../dom.ts";
+import { Document } from "../docbook/document.ts";
+import { Config } from "../config.ts";
+import { el, stylesheetLinkElement, text } from "./utils.ts";
+
+function metaElement(attrs: [string, string][]): Element {
+ return el("meta", attrs);
+}
+
+function linkElement(rel: string, href: string, type: string | null): Element {
+ const attrs: [string, string][] = [["rel", rel], ["href", href]];
+ if (type !== null) {
+ attrs.push(["type", type]);
+ }
+ return el("link", attrs);
+}
+
+export default async function generateAbout(
+ config: Config,
+): Promise<Document> {
+ 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; ${config.blog.siteCopyrightYear} ${config.blog.author}`,
+ ]]),
+ metaElement([["name", "description"], [
+ "content",
+ "このサイトの著者について",
+ ]]),
+ linkElement("icon", "/favicon.svg", "image/svg+xml"),
+ el("title", [], text(`About | ${config.blog.siteName}`)),
+ await stylesheetLinkElement("/style.css", config),
+ );
+ const body = el(
+ "body",
+ [["class", "single"]],
+ el(
+ "header",
+ [["class", "header"]],
+ el(
+ "nav",
+ [["class", "nav"]],
+ el(
+ "ul",
+ [],
+ el(
+ "li",
+ [["class", "logo"]],
+ el("a", [["href", "/"]], text(config.blog.siteName)),
+ ),
+ el(
+ "li",
+ [],
+ el("a", [["href", "/about"]], text("About")),
+ ),
+ el(
+ "li",
+ [],
+ el("a", [["href", "/posts"]], text("Posts")),
+ ),
+ el(
+ "li",
+ [],
+ el("a", [["href", "/slides"]], text("Slides")),
+ ),
+ ),
+ ),
+ ),
+ el(
+ "main",
+ [["class", "main"]],
+ el(
+ "article",
+ [["class", "post-single"]],
+ el(
+ "header",
+ [["class", "post-header"]],
+ el(
+ "h1",
+ [["class", "post-title"]],
+ text("About"),
+ ),
+ ),
+ el(
+ "div",
+ [["class", "post-content"]],
+ text("WIP"),
+ ),
+ ),
+ ),
+ el(
+ "footer",
+ [["class", "footer"]],
+ text(
+ `&copy; ${config.blog.siteCopyrightYear} ${config.blog.author}`,
+ ),
+ ),
+ );
+ const html = el(
+ "html",
+ [["lang", "ja-JP"]],
+ head,
+ body,
+ );
+ const doc = {
+ root: el("__root__", [], html),
+ sourceFilePath: "<about>",
+ link: "/about/",
+ title: "About",
+ summary: "このサイトの著者について",
+ tags: [],
+ revisions: [],
+ };
+ return doc;
+}