aboutsummaryrefslogtreecommitdiffhomepage
path: root/nuldoc-src/pages/post_list.ts
diff options
context:
space:
mode:
Diffstat (limited to 'nuldoc-src/pages/post_list.ts')
-rw-r--r--nuldoc-src/pages/post_list.ts84
1 files changed, 16 insertions, 68 deletions
diff --git a/nuldoc-src/pages/post_list.ts b/nuldoc-src/pages/post_list.ts
index e22316e..09d1942 100644
--- a/nuldoc-src/pages/post_list.ts
+++ b/nuldoc-src/pages/post_list.ts
@@ -1,13 +1,10 @@
+import { globalFooter } from "../components/global_footer.ts";
+import { globalHeader } from "../components/global_header.ts";
+import { pageLayout } from "../components/page_layout.ts";
import { Config } from "../config.ts";
+import { el, text } from "../dom.ts";
import { Page } from "../page.ts";
import { getPostCreatedDate, getPostUpdatedDate, PostPage } from "./post.ts";
-import {
- el,
- linkElement,
- metaElement,
- stylesheetLinkElement,
- text,
-} from "./utils.ts";
export type PostListPage = Page;
@@ -17,59 +14,10 @@ export async function generatePostListPage(
): Promise<PostListPage> {
const pageTitle = "投稿一覧";
- 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(`${pageTitle} | ${config.blog.siteName}`)),
- await stylesheetLinkElement("/style.css", config),
- );
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")),
- ),
- ),
- ),
- ),
+ globalHeader(config),
el(
"main",
[["class", "main"]],
@@ -128,19 +76,19 @@ export async function generatePostListPage(
)
),
),
- el(
- "footer",
- [["class", "footer"]],
- text(
- `&copy; ${config.blog.siteCopyrightYear} ${config.blog.author}`,
- ),
- ),
+ globalFooter(config),
);
- const html = el(
- "html",
- [["lang", "ja-JP"]],
- head,
+
+ const html = await pageLayout(
+ {
+ metaCopyrightYear: config.blog.siteCopyrightYear,
+ metaDescription: "投稿した記事の一覧",
+ metaKeywords: [],
+ metaTitle: pageTitle,
+ requiresSyntaxHighlight: false,
+ },
body,
+ config,
);
return {