-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpost.tsx
More file actions
33 lines (28 loc) · 854 Bytes
/
post.tsx
File metadata and controls
33 lines (28 loc) · 854 Bytes
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 { renderToString } from "preact-render-to-string";
import { html } from "utils/html.ts";
import { href, output } from "utils/path.ts";
import { write } from "utils/fs.ts";
import { Layout } from "components/Layout.tsx";
import { BlogPost, type BlogPostProps } from "components/BlogPost.tsx";
import { posts } from "./utils.ts";
function Post(props: BlogPostProps) {
return (
<Layout>
<BlogPost {...props} />
</Layout>
);
}
if (import.meta.main) {
for await (const post of posts()) {
await write(
output(post.file),
html(renderToString(<Post {...post} />), {
title: `${post.meta.title} · Nova`,
description: post.meta.description,
author: post.meta.authors.map((author) => author.name).join(", "),
canonical: href(post.file),
highlight: true,
}),
);
}
}