1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
import { renderToDOM } from "../jsx/render.ts";
import TagPage from "../pages/TagPage.tsx";
import { Config, getTagLabel } from "../config.ts";
import { Page } from "../page.ts";
import { TaggedPage } from "./tagged_page.ts";
export interface TagPage extends Page {
tagSlug: string;
tagLabel: string;
numOfPosts: number;
numOfSlides: number;
}
export async function generateTagPage(
tagSlug: string,
pages: TaggedPage[],
config: Config,
): Promise<TagPage> {
const html = await renderToDOM(
TagPage(tagSlug, pages, config),
);
return {
root: html,
renderer: "html",
destFilePath: `/tags/${tagSlug}/index.html`,
href: `/tags/${tagSlug}/`,
tagSlug: tagSlug,
tagLabel: getTagLabel(config, tagSlug),
numOfPosts: pages.filter((p) => !("event" in p)).length,
numOfSlides: pages.filter((p) => "event" in p).length,
};
}
|