diff options
| author | nsfisis <nsfisis@gmail.com> | 2023-03-17 01:03:59 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2023-03-17 01:03:59 +0900 |
| commit | ee72f8780cf3681e4202cc3a6358fb4038db1ec8 (patch) | |
| tree | bb3b375339757f4677df03ea4d06268e18ae8de5 /nuldoc-src/command.ts | |
| parent | f5b1c4d1429356ebcef2a8cdd7b5d311a9477a6c (diff) | |
| download | blog.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/command.ts')
| -rw-r--r-- | nuldoc-src/command.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/nuldoc-src/command.ts b/nuldoc-src/command.ts index 70532d4..57e4820 100644 --- a/nuldoc-src/command.ts +++ b/nuldoc-src/command.ts @@ -10,6 +10,7 @@ import { Document } from "./docbook/document.ts"; import convertPost from "./templates/post.ts"; import convertPostList from "./templates/post_list.ts"; import convertTag from "./templates/tag.ts"; +import generateAbout from "./templates/about.ts"; export async function run(command: string, config: Config) { if (command === "build") { @@ -25,6 +26,7 @@ async function cmdBuild(config: Config) { const posts = await generatePosts(config); await generateTags(posts, config); await generatePostList(posts, config); + await generateAboutPage(config); await copyStaticFiles(config); } @@ -110,6 +112,19 @@ async function outputPostList(postList: Document, config: Config) { await writeHtmlFile(postList, destFilePath); } +async function generateAboutPage(config: Config) { + const aboutDoc = await generateAbout(config); + await outputAboutPage(aboutDoc, config); +} + +async function outputAboutPage(about: Document, config: Config) { + const cwd = Deno.cwd(); + const destDir = join(cwd, config.locations.destDir); + const destFilePath = join(destDir, "about", "index.html"); + await ensureDir(dirname(destFilePath)); + await writeHtmlFile(about, destFilePath); +} + async function generateTags(posts: Document[], config: Config) { const tagsAndPosts = collectTags(posts); const tagDocs = await buildTagDocs(tagsAndPosts, config); |
