summaryrefslogtreecommitdiffhomepage
path: root/vhosts/blog/nuldoc-src/generators/post_list.ts
blob: 67a4b9969e121da9c795184c7fab163132a1560b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { renderToDOM } from "../jsx/render.ts";
import PostListPage from "../pages/PostListPage.tsx";
import { Config } from "../config.ts";
import { Page } from "../page.ts";
import { PostPage } from "./post.ts";

export type PostListPage = Page;

export async function generatePostListPage(
  posts: PostPage[],
  config: Config,
): Promise<PostListPage> {
  const html = await renderToDOM(
    PostListPage(posts, config),
  );

  return {
    root: html,
    renderer: "html",
    destFilePath: "/posts/index.html",
    href: "/posts/",
  };
}