Files
aurora/src/pages/index.astro

38 lines
1.0 KiB
Plaintext
Raw Normal View History

2023-05-18 13:40:53 +02:00
---
2023-05-18 17:31:16 +02:00
import { getEntryBySlug, getCollection } from "astro:content";
import PageLayout from "../layouts/PageLayout.astro";
import PublicationDate from "../components/PublicationDate.astro";
import TableOfContents from "../components/TableOfContents.svelte";
const home = await getEntryBySlug("home", "home");
const { Content, headings } = await home.render();
const articles = (await getCollection("blog")).sort(
(a, b) => b.data.publicationDate.valueOf() - a.data.publicationDate.valueOf()
);
2023-05-18 13:40:53 +02:00
---
2023-05-18 17:31:16 +02:00
<PageLayout {...home.data}>
2023-05-18 20:20:43 +02:00
<TableOfContents slot="nav" client:only="svelte" {headings} />
2023-05-18 17:31:16 +02:00
<Content />
{
articles.map((article) => (
<article>
<PublicationDate publicationDate={article.data.publicationDate} />
<h2>
<a href={article.slug}>{article.data.title}</a>
</h2>
<p>{article.data.description}</p>
</article>
))
}
</PageLayout>
<style>
article:not(:first-of-type) {
margin-block-start: 2rem;
padding-block-start: 2rem;
border-block-start: var(--standard-border);
}
</style>