diff options
| author | nsfisis <nsfisis@gmail.com> | 2023-03-18 19:42:37 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2023-03-18 19:42:37 +0900 |
| commit | 032dc3c5e6d0ef84a9f4ea6be10e19b7f43c53b8 (patch) | |
| tree | 0909d231d62f43f3d2a3b7e1bd9dddf3a7be365e /nuldoc-src/commands/build.ts | |
| parent | 1301f9d35cec5d24b772518b1daa7ffe15684525 (diff) | |
| download | blog.nsfisis.dev-032dc3c5e6d0ef84a9f4ea6be10e19b7f43c53b8.tar.gz blog.nsfisis.dev-032dc3c5e6d0ef84a9f4ea6be10e19b7f43c53b8.tar.zst blog.nsfisis.dev-032dc3c5e6d0ef84a9f4ea6be10e19b7f43c53b8.zip | |
feat(content): add /tags/ page
Diffstat (limited to 'nuldoc-src/commands/build.ts')
| -rw-r--r-- | nuldoc-src/commands/build.ts | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/nuldoc-src/commands/build.ts b/nuldoc-src/commands/build.ts index d523861..911ff50 100644 --- a/nuldoc-src/commands/build.ts +++ b/nuldoc-src/commands/build.ts @@ -13,12 +13,14 @@ import { PostPage, } from "../pages/post.ts"; import { generatePostListPage } from "../pages/post_list.ts"; -import { generateTagPage } from "../pages/tag.ts"; +import { generateTagPage, TagPage } from "../pages/tag.ts"; +import { generateTagListPage } from "../pages/tag_list.ts"; export async function runBuildCommand(config: Config) { const posts = await buildPostPages(config); await buildPostListPage(posts, config); - await buildTagPages(posts, config); + const tags = await buildTagPages(posts, config); + await buildTagListPage(tags, config); await buildAboutPage(config); await buildNotFoundPage(config); await copyStaticFiles(config); @@ -71,12 +73,23 @@ async function buildNotFoundPage(config: Config) { await writePage(notFoundPage, config); } -async function buildTagPages(posts: PostPage[], config: Config) { +async function buildTagPages( + posts: PostPage[], + config: Config, +): Promise<TagPage[]> { const tagsAndPosts = collectTags(posts); + const tags = []; for (const [tag, posts] of tagsAndPosts) { const tagPage = await generateTagPage(tag, posts, config); await writePage(tagPage, config); + tags.push(tagPage); } + return tags; +} + +async function buildTagListPage(tags: TagPage[], config: Config) { + const tagListPage = await generateTagListPage(tags, config); + await writePage(tagListPage, config); } function collectTags(posts: PostPage[]): [string, PostPage[]][] { |
