Upgrade to Astro 6.1.9 and migrate to content layer API
Moves content config from src/content/config.ts to src/content.config.ts with glob loaders as required by Astro 6. Replaces entry.slug with entry.id and entry.render() with render(entry) throughout. Removes legacy collections option from astro.config.mjs.
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
---
|
||||
import { type CollectionEntry, getCollection } from 'astro:content';
|
||||
import { type CollectionEntry, getCollection, render } from 'astro:content';
|
||||
import Entry from '../../layouts/Entry.astro';
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const entries = await getCollection('entries');
|
||||
return entries.map((entry) => ({
|
||||
params: { slug: entry.slug },
|
||||
params: { slug: entry.id },
|
||||
props: entry,
|
||||
}));
|
||||
}
|
||||
type Props = CollectionEntry<'entries'>;
|
||||
|
||||
const entry = Astro.props;
|
||||
const { Content, remarkPluginFrontmatter } = await entry.render();
|
||||
const { Content, remarkPluginFrontmatter } = await render(entry);
|
||||
entry.data.frontmatter = remarkPluginFrontmatter;
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user