mirror of
https://github.com/andwati/andwati.com.git
synced 2026-11-13 04:15:12 +00:00
Wire Astro content collections to the shared content/ directory
Adds a custom Astro loader that reads the Zola-style TOML frontmatter (+++ ... +++) directly, so content/ stays the single source of truth with no YAML conversion step. Defines writings/portfolio/bookshelf/ blogs collections and basic list/detail pages for each, rendering the seed entries end-to-end (verified in-browser via `pnpm --filter site dev`). This is the first runnable MVP: home, writings list + post detail, portfolio, bookshelf (books and papers), and curated blogs all render from real content/ files.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
---
|
||||
import { getCollection, render } from "astro:content";
|
||||
import Base from "../../layouts/Base.astro";
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const writings = await getCollection("writings", ({ data }) => !data.draft);
|
||||
return writings.map((entry) => ({
|
||||
params: { slug: entry.id },
|
||||
props: { entry },
|
||||
}));
|
||||
}
|
||||
|
||||
const { entry } = Astro.props;
|
||||
const { Content } = await render(entry);
|
||||
---
|
||||
|
||||
<Base title={entry.data.title}>
|
||||
<h1>{entry.data.title}</h1>
|
||||
<p class="meta">
|
||||
{entry.data.date.toDateString()}
|
||||
{entry.data.updated && <> · updated {entry.data.updated.toDateString()}</>}
|
||||
</p>
|
||||
{entry.data.taxonomies?.tags.map((tag) => <span class="tag">#{tag}</span>)}
|
||||
<article>
|
||||
<Content />
|
||||
</article>
|
||||
</Base>
|
||||
Reference in New Issue
Block a user