0
mirror of https://github.com/valentineus/popov.link.git synced 2025-07-04 08:30:27 +03:00

Initial Astro project

This commit is contained in:
2024-09-04 21:16:37 +00:00
parent ecf9a15e77
commit 7eff3fde57
66 changed files with 7118 additions and 2173 deletions

View File

@ -0,0 +1,20 @@
---
import { type CollectionEntry, getCollection } from "astro:content";
import Layout from "../../layouts/PostLayout.astro";
export async function getStaticPaths() {
const posts = await getCollection("blog");
return posts.map((post) => ({
params: { slug: post.slug },
props: post,
}));
}
type Props = CollectionEntry<"blog">;
const post = Astro.props;
const { Content } = await post.render();
---
<Layout>
<Content />
</Layout>

18
src/pages/index.astro Normal file
View File

@ -0,0 +1,18 @@
---
import Layout from "../layouts/PageLayout.astro";
import { getCollection } from "astro:content";
const posts = await getCollection("blog");
---
<Layout>
<ul>
{
posts.map((post) => (
<li>
<a href={`/blog/${post.slug}`}>{post.data.title}</a>
</li>
))
}
</ul>
</Layout>