scaffolding
This commit is contained in:
32
src/pages/blog/index.astro
Normal file
32
src/pages/blog/index.astro
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
const posts = Object.entries(
|
||||
import.meta.glob('./*.md', { eager: true })
|
||||
).map(([path, post]) => {
|
||||
const slug = path.replace('./', '').replace('.md', '');
|
||||
|
||||
return {
|
||||
title: post.frontmatter.title,
|
||||
url: `/blog/${slug}/`,
|
||||
};
|
||||
});
|
||||
---
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Blog | Withered Sanctum</title>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<h1>Blog</h1>
|
||||
|
||||
<ul>
|
||||
{posts.map((post) => (
|
||||
<li>
|
||||
<a href={post.url}>{post.title}</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user