aboutsummaryrefslogtreecommitdiffhomepage
path: root/nuldoc-src/commands/build.ts
diff options
context:
space:
mode:
Diffstat (limited to 'nuldoc-src/commands/build.ts')
-rw-r--r--nuldoc-src/commands/build.ts19
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[]][] {