a bit of stuff
This commit is contained in:
19
routes/posts/index.server.ts
Normal file
19
routes/posts/index.server.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { html, htmlToResponse } from "@mastrojs/mastro";
|
||||
import { readMarkdownFiles } from "@mastrojs/markdown";
|
||||
import { Layout } from "../../components/Layout.ts";
|
||||
|
||||
export const GET = async () => {
|
||||
const posts = await readMarkdownFiles("data/posts/*.md");
|
||||
return htmlToResponse(
|
||||
Layout({
|
||||
title: "Posts",
|
||||
children: posts.map(
|
||||
(post) => html`
|
||||
<p>
|
||||
<a href="${post.path.slice(12, -3) + "/"}"> ${post.meta.title} </a>
|
||||
</p>
|
||||
`,
|
||||
),
|
||||
}),
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user