Skip to content

Commit 84da0e6

Browse files
Copilotmahata
andauthored
fix: migrate to Astro Content Layer API to resolve LegacyContentConfigError
Agent-Logs-Url: https://github.com/mahata/mahata.github.io/sessions/418b8b3c-e335-48de-93fb-d45e48dc419b Co-authored-by: mahata <23497+mahata@users.noreply.github.com>
1 parent fa2eb98 commit 84da0e6

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { defineCollection, z } from 'astro:content';
2+
import { glob } from 'astro/loaders';
23

34
const blog = defineCollection({
4-
type: 'content',
5+
loader: glob({ pattern: '**/*.md', base: './src/content/blog' }),
56
schema: z.object({
67
title: z.string(),
78
date: z.date(),

src/pages/blog/[...slug].astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
import { getCollection } from 'astro:content';
2+
import { getCollection, render } from 'astro:content';
33
import Post from '../../layouts/Post.astro';
44
import { getSlugFromId } from '../../utils/posts';
55
@@ -12,7 +12,7 @@ export async function getStaticPaths() {
1212
}
1313
1414
const { post } = Astro.props;
15-
const { Content } = await post.render();
15+
const { Content } = await render(post);
1616
---
1717

1818
<Post post={post}>

0 commit comments

Comments
 (0)