aboutsummaryrefslogtreecommitdiffhomepage
path: root/nuldoc-src
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2023-03-18 19:58:38 +0900
committernsfisis <nsfisis@gmail.com>2023-03-18 19:58:38 +0900
commit7688362ad3b57b0cdd6f048d1e595f69748fc183 (patch)
tree5524182d1cc29f55b9b60ce7799497d4d8141929 /nuldoc-src
parent7f15e0b8277ac8b101b4f71ce57c1c5442927141 (diff)
downloadblog.nsfisis.dev-7688362ad3b57b0cdd6f048d1e595f69748fc183.tar.gz
blog.nsfisis.dev-7688362ad3b57b0cdd6f048d1e595f69748fc183.tar.zst
blog.nsfisis.dev-7688362ad3b57b0cdd6f048d1e595f69748fc183.zip
feat(content): add / page
Diffstat (limited to 'nuldoc-src')
-rw-r--r--nuldoc-src/commands/build.ts7
-rw-r--r--nuldoc-src/components/page_layout.ts2
-rw-r--r--nuldoc-src/pages/about.ts2
-rw-r--r--nuldoc-src/pages/home.ts96
-rw-r--r--nuldoc-src/pages/not_found.ts2
-rw-r--r--nuldoc-src/pages/post.ts2
-rw-r--r--nuldoc-src/pages/post_list.ts2
-rw-r--r--nuldoc-src/pages/tag.ts2
-rw-r--r--nuldoc-src/pages/tag_list.ts2
9 files changed, 110 insertions, 7 deletions
diff --git a/nuldoc-src/commands/build.ts b/nuldoc-src/commands/build.ts
index 911ff50..fad5c75 100644
--- a/nuldoc-src/commands/build.ts
+++ b/nuldoc-src/commands/build.ts
@@ -6,6 +6,7 @@ import { parseDocBookFile } from "../docbook/parse.ts";
import { Page } from "../page.ts";
import { render } from "../render.ts";
import { generateAboutPage } from "../pages/about.ts";
+import { generateHomePage } from "../pages/home.ts";
import { generateNotFoundPage } from "../pages/not_found.ts";
import {
generatePostPage,
@@ -21,6 +22,7 @@ export async function runBuildCommand(config: Config) {
await buildPostListPage(posts, config);
const tags = await buildTagPages(posts, config);
await buildTagListPage(tags, config);
+ await buildHomePage(config);
await buildAboutPage(config);
await buildNotFoundPage(config);
await copyStaticFiles(config);
@@ -63,6 +65,11 @@ async function buildPostListPage(posts: PostPage[], config: Config) {
await writePage(postListPage, config);
}
+async function buildHomePage(config: Config) {
+ const homePage = await generateHomePage(config);
+ await writePage(homePage, config);
+}
+
async function buildAboutPage(config: Config) {
const aboutPage = await generateAboutPage(config);
await writePage(aboutPage, config);
diff --git a/nuldoc-src/components/page_layout.ts b/nuldoc-src/components/page_layout.ts
index d76e3b2..7dc6a43 100644
--- a/nuldoc-src/components/page_layout.ts
+++ b/nuldoc-src/components/page_layout.ts
@@ -46,7 +46,7 @@ export async function pageLayout(
]]),
]),
linkElement("icon", "/favicon.svg", "image/svg+xml"),
- el("title", [], text(`${metaTitle} | ${config.blog.siteName}`)),
+ el("title", [], text(metaTitle)),
await stylesheetLinkElement("/style.css", config),
...(
requiresSyntaxHighlight
diff --git a/nuldoc-src/pages/about.ts b/nuldoc-src/pages/about.ts
index 4f98930..ab60c2b 100644
--- a/nuldoc-src/pages/about.ts
+++ b/nuldoc-src/pages/about.ts
@@ -42,7 +42,7 @@ export async function generateAboutPage(config: Config): Promise<AboutPage> {
metaCopyrightYear: config.blog.siteCopyrightYear,
metaDescription: "このサイトの著者について",
metaKeywords: [],
- metaTitle: "About",
+ metaTitle: `About | ${config.blog.siteName}`,
requiresSyntaxHighlight: false,
},
body,
diff --git a/nuldoc-src/pages/home.ts b/nuldoc-src/pages/home.ts
new file mode 100644
index 0000000..a240278
--- /dev/null
+++ b/nuldoc-src/pages/home.ts
@@ -0,0 +1,96 @@
+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";
+
+export type HomePage = Page;
+
+export async function generateHomePage(config: Config): Promise<HomePage> {
+ const body = el(
+ "body",
+ [["class", "single"]],
+ globalHeader(config),
+ el(
+ "main",
+ [["class", "main"]],
+ el(
+ "article",
+ [["class", "post-single"]],
+ el(
+ "article",
+ [["class", "post-entry"]],
+ el(
+ "a",
+ [["href", "/about/"]],
+ el(
+ "header",
+ [["class", "entry-header"]],
+ el("h2", [], text("About")),
+ ),
+ ),
+ ),
+ el(
+ "article",
+ [["class", "post-entry"]],
+ el(
+ "a",
+ [["href", "/posts/"]],
+ el(
+ "header",
+ [["class", "entry-header"]],
+ el("h2", [], text("Posts")),
+ ),
+ ),
+ ),
+ el(
+ "article",
+ [["class", "post-entry"]],
+ el(
+ "a",
+ [["href", "/slides/"]],
+ el(
+ "header",
+ [["class", "entry-header"]],
+ el("h2", [], text("Slides")),
+ ),
+ ),
+ ),
+ el(
+ "article",
+ [["class", "post-entry"]],
+ el(
+ "a",
+ [["href", "/tags/"]],
+ el(
+ "header",
+ [["class", "entry-header"]],
+ el("h2", [], text("Tags")),
+ ),
+ ),
+ ),
+ ),
+ ),
+ globalFooter(config),
+ );
+
+ const html = await pageLayout(
+ {
+ metaCopyrightYear: config.blog.siteCopyrightYear,
+ metaDescription: "nsfisis のブログサイト",
+ metaKeywords: [],
+ metaTitle: config.blog.siteName,
+ requiresSyntaxHighlight: false,
+ },
+ body,
+ config,
+ );
+
+ return {
+ root: el("__root__", [], html),
+ renderer: "html",
+ destFilePath: "/index.html",
+ href: "/",
+ };
+}
diff --git a/nuldoc-src/pages/not_found.ts b/nuldoc-src/pages/not_found.ts
index 65938dd..a1b6109 100644
--- a/nuldoc-src/pages/not_found.ts
+++ b/nuldoc-src/pages/not_found.ts
@@ -35,7 +35,7 @@ export async function generateNotFoundPage(
metaCopyrightYear: config.blog.siteCopyrightYear,
metaDescription: "リクエストされたページが見つかりません。",
metaKeywords: [],
- metaTitle: "Page Not Found",
+ metaTitle: `Page Not Found | ${config.blog.siteName}`,
requiresSyntaxHighlight: false,
},
body,
diff --git a/nuldoc-src/pages/post.ts b/nuldoc-src/pages/post.ts
index 597a667..0bc313b 100644
--- a/nuldoc-src/pages/post.ts
+++ b/nuldoc-src/pages/post.ts
@@ -120,7 +120,7 @@ export async function generatePostPage(
metaKeywords: doc.tags.map((slug) =>
(config.blog.tagLabels as { [key: string]: string })[slug]
),
- metaTitle: doc.title,
+ metaTitle: `${doc.title} | ${config.blog.siteName}`,
requiresSyntaxHighlight: true,
},
body,
diff --git a/nuldoc-src/pages/post_list.ts b/nuldoc-src/pages/post_list.ts
index 5b511b0..ce26645 100644
--- a/nuldoc-src/pages/post_list.ts
+++ b/nuldoc-src/pages/post_list.ts
@@ -84,7 +84,7 @@ export async function generatePostListPage(
metaCopyrightYear: config.blog.siteCopyrightYear,
metaDescription: "投稿した記事の一覧",
metaKeywords: [],
- metaTitle: pageTitle,
+ metaTitle: `${pageTitle} | ${config.blog.siteName}`,
requiresSyntaxHighlight: false,
},
body,
diff --git a/nuldoc-src/pages/tag.ts b/nuldoc-src/pages/tag.ts
index a7ffbb2..c0b6262 100644
--- a/nuldoc-src/pages/tag.ts
+++ b/nuldoc-src/pages/tag.ts
@@ -78,7 +78,7 @@ export async function generateTagPage(
),
metaDescription: `タグ「${tagLabel}」のついた記事一覧`,
metaKeywords: [tagLabel],
- metaTitle: pageTitle,
+ metaTitle: `${pageTitle} | ${config.blog.siteName}`,
requiresSyntaxHighlight: false,
},
body,
diff --git a/nuldoc-src/pages/tag_list.ts b/nuldoc-src/pages/tag_list.ts
index e4e53f0..bb481f8 100644
--- a/nuldoc-src/pages/tag_list.ts
+++ b/nuldoc-src/pages/tag_list.ts
@@ -60,7 +60,7 @@ export async function generateTagListPage(
metaCopyrightYear: config.blog.siteCopyrightYear,
metaDescription: "タグの一覧",
metaKeywords: [],
- metaTitle: pageTitle,
+ metaTitle: `${pageTitle} | ${config.blog.siteName}`,
requiresSyntaxHighlight: false,
},
body,