aboutsummaryrefslogtreecommitdiffhomepage
path: root/nuldoc-src/templates/tag.ts
diff options
context:
space:
mode:
Diffstat (limited to 'nuldoc-src/templates/tag.ts')
-rw-r--r--nuldoc-src/templates/tag.ts147
1 files changed, 0 insertions, 147 deletions
diff --git a/nuldoc-src/templates/tag.ts b/nuldoc-src/templates/tag.ts
deleted file mode 100644
index 8aeac58..0000000
--- a/nuldoc-src/templates/tag.ts
+++ /dev/null
@@ -1,147 +0,0 @@
-import { Document } from "../docbook/document.ts";
-import { Config } from "../config.ts";
-import {
- el,
- linkElement,
- metaElement,
- stylesheetLinkElement,
- text,
-} from "./utils.ts";
-
-export default async function convertTag(
- tag: string,
- posts: Document[],
- config: Config,
-): Promise<Document> {
- const tagLabel = (config.blog.tagLabels as { [key: string]: string })[tag];
-
- const doc = new Document(
- el("__root__", []),
- `<tag:${tag}>`,
- `/tags/${tag}/`,
- `タグ「${tagLabel}」一覧`,
- `タグ「${tagLabel}」のついた記事一覧`,
- [],
- [],
- );
-
- const headChildren = [
- 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; ${
- posts[posts.length - 1].getCreatedDate().substring(0, 4)
- } ${config.blog.author}`,
- ]]),
- metaElement([["name", "description"], [
- "content",
- doc.summary,
- ]]),
- metaElement([["name", "keywords"], ["content", tagLabel]]),
- linkElement("icon", "/favicon.svg", "image/svg+xml"),
- el("title", [], text(`${doc.title} | ${config.blog.siteName}`)),
- await stylesheetLinkElement("/style.css", config),
- ];
- const head = el("head", [], ...headChildren);
- const body = el(
- "body",
- [["class", "list"]],
- 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("header", [["class", "page-header"]], el("h1", [], text(doc.title))),
- ...posts.map((post) =>
- el(
- "article",
- [["class", "post-entry"]],
- el(
- "a",
- [["href", post.link]],
- el(
- "header",
- [["class", "entry-header"]],
- el("h2", [], text(post.title)),
- ),
- el(
- "section",
- [["class", "entry-content"]],
- el("p", [], text(post.summary)),
- ),
- el(
- "footer",
- [["class", "entry-footer"]],
- text("Posted on"),
- el(
- "time",
- [["datetime", post.getCreatedDate()]],
- text(post.getCreatedDate()),
- ),
- ...(post.revisions.length > 1
- ? [
- text(", updated on "),
- el("time", [[
- "datetime",
- post.getUpdatedDate(),
- ]], text(post.getUpdatedDate())),
- ]
- : []),
- ),
- ),
- )
- ),
- ),
- el(
- "footer",
- [["class", "footer"]],
- text(
- `&copy; ${config.blog.siteCopyrightYear} ${config.blog.author}`,
- ),
- ),
- );
- const html = el(
- "html",
- [["lang", "ja-JP"]],
- head,
- body,
- );
-
- doc.root.children = [html];
- return doc;
-}