mirror of
https://github.com/maciejpedzich/maciejpedzi.ch.git
synced 2025-02-05 21:28:35 +01:00
Update Astro to 5.0 and adapt content collections to breaking changes
This commit is contained in:
parent
928b9dee13
commit
b4df9225aa
2850
package-lock.json
generated
2850
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
10
package.json
10
package.json
@ -10,10 +10,10 @@
|
|||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/mdx": "^3.1.7",
|
"@astrojs/mdx": "^4.0.2",
|
||||||
"@astrojs/rss": "^4.0.7",
|
"@astrojs/rss": "^4.0.10",
|
||||||
"@astrojs/sitemap": "^3.1.6",
|
"@astrojs/sitemap": "^3.2.1",
|
||||||
"@fontsource/roboto": "^5.0.13",
|
"@fontsource/roboto": "^5.1.0",
|
||||||
"astro": "^4.16.3"
|
"astro": "^5.0.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ const posts = (
|
|||||||
<ul class="post-list">
|
<ul class="post-list">
|
||||||
{posts.map((post) => (
|
{posts.map((post) => (
|
||||||
<li>
|
<li>
|
||||||
<a href={`/blog/${post.slug}`}>{post.data.title}</a>
|
<a href={`/blog/${post.id}`}>{post.data.title}</a>
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
import { defineCollection, z } from 'astro:content';
|
import { defineCollection, z } from 'astro:content';
|
||||||
|
import { glob } from 'astro/loaders';
|
||||||
|
|
||||||
const blog = defineCollection({
|
const blog = defineCollection({
|
||||||
|
loader: glob({ pattern: '**/*.md', base: './src/content/blog' }),
|
||||||
schema: z.object({
|
schema: z.object({
|
||||||
title: z.string(),
|
title: z.string(),
|
||||||
description: z.string(),
|
description: z.string(),
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
import type { CollectionEntry } from 'astro:content';
|
import type { CollectionEntry } from 'astro:content';
|
||||||
import { getCollection } from 'astro:content';
|
import { getCollection, render } from 'astro:content';
|
||||||
|
|
||||||
import BlogPost from '../../layouts/BlogPost.astro';
|
import BlogPost from '../../layouts/BlogPost.astro';
|
||||||
import TableOfContents from '../../components/TableOfContents.astro';
|
import TableOfContents from '../../components/TableOfContents.astro';
|
||||||
@ -9,7 +9,7 @@ export async function getStaticPaths() {
|
|||||||
const posts = await getCollection('blog');
|
const posts = await getCollection('blog');
|
||||||
|
|
||||||
return posts.map((post) => ({
|
return posts.map((post) => ({
|
||||||
params: { slug: post.slug },
|
params: { slug: post.id },
|
||||||
props: post
|
props: post
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@ -17,7 +17,7 @@ export async function getStaticPaths() {
|
|||||||
type Props = CollectionEntry<'blog'>;
|
type Props = CollectionEntry<'blog'>;
|
||||||
|
|
||||||
const post = Astro.props;
|
const post = Astro.props;
|
||||||
const { Content, headings } = await post.render();
|
const { Content, headings } = await render(post);
|
||||||
---
|
---
|
||||||
|
|
||||||
<BlogPost {...post.data}>
|
<BlogPost {...post.data}>
|
||||||
|
Loading…
Reference in New Issue
Block a user