33 lines
801 B
TypeScript
33 lines
801 B
TypeScript
import { html, htmlToResponse } from "@mastrojs/mastro";
|
|
import { Layout } from "../components/Layout.ts";
|
|
import { readMarkdownFiles } from "@mastrojs/markdown";
|
|
|
|
export const GET = async () => {
|
|
const posts = await readMarkdownFiles("data/posts/*.md");
|
|
|
|
return htmlToResponse(
|
|
Layout({
|
|
title: "Home",
|
|
children: html`
|
|
<!-- <nav> -->
|
|
<!-- <p><a href="/posts/">Posts</a></p> -->
|
|
<!-- </nav> -->
|
|
|
|
<h2>About me</h2>
|
|
<p>I am a (human) developer.</p>
|
|
|
|
<h2>Posts</h2>
|
|
<div class="post-list">
|
|
${posts.map(
|
|
(post) => html`
|
|
<a href="posts/${post.path.slice(12, -3) + "/"}">
|
|
${post.meta.title}
|
|
</a>
|
|
`,
|
|
)}
|
|
</div>
|
|
`,
|
|
}),
|
|
);
|
|
};
|