diff options
| -rw-r--r-- | nuldoc-src/commands/build.ts | 7 | ||||
| -rw-r--r-- | nuldoc-src/components/page_layout.ts | 2 | ||||
| -rw-r--r-- | nuldoc-src/pages/about.ts | 2 | ||||
| -rw-r--r-- | nuldoc-src/pages/home.ts | 96 | ||||
| -rw-r--r-- | nuldoc-src/pages/not_found.ts | 2 | ||||
| -rw-r--r-- | nuldoc-src/pages/post.ts | 2 | ||||
| -rw-r--r-- | nuldoc-src/pages/post_list.ts | 2 | ||||
| -rw-r--r-- | nuldoc-src/pages/tag.ts | 2 | ||||
| -rw-r--r-- | nuldoc-src/pages/tag_list.ts | 2 | ||||
| -rw-r--r-- | public/index.html | 67 |
10 files changed, 177 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, diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..cbebcb0 --- /dev/null +++ b/public/index.html @@ -0,0 +1,67 @@ +<!DOCTYPE html> +<html lang="ja-JP"> + <head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <meta name="author" content="nsfisis"> + <meta name="copyright" content="© 2021 nsfisis"> + <meta name="description" content="nsfisis のブログサイト"> + <link rel="icon" type="image/svg+xml" href="/favicon.svg"> + <title>REPL: Rest-Eat-Program Loop</title> + <link rel="stylesheet" href="/style.css?h=48694677b43b77e5c45f25e6bfdebb41"> + </head> + <body class="single"> + <header class="header"> + <nav class="nav"> + <ul> + <li class="logo"> + <a href="/">REPL: Rest-Eat-Program Loop</a> + </li> + <li> + <a href="/about/">About</a> + </li> + <li> + <a href="/posts/">Posts</a> + </li> + <li> + <a href="/slides/">Slides</a> + </li> + <li> + <a href="/tags/">Tags</a> + </li> + </ul> + </nav> + </header> + <main class="main"> + <article class="post-single"> + <article class="post-entry"> + <a href="/about/"> <header class="entry-header"> + <h2>About</h2> + </header> +</a> + </article> + <article class="post-entry"> + <a href="/posts/"> <header class="entry-header"> + <h2>Posts</h2> + </header> +</a> + </article> + <article class="post-entry"> + <a href="/slides/"> <header class="entry-header"> + <h2>Slides</h2> + </header> +</a> + </article> + <article class="post-entry"> + <a href="/tags/"> <header class="entry-header"> + <h2>Tags</h2> + </header> +</a> + </article> + </article> + </main> + <footer class="footer"> + © 2021 nsfisis + </footer> + </body> +</html> |
