mirror of
https://github.com/maciejpedzich/maciejpedzi.ch.git
synced 2025-02-05 13:18:36 +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"
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/mdx": "^3.1.7",
|
||||
"@astrojs/rss": "^4.0.7",
|
||||
"@astrojs/sitemap": "^3.1.6",
|
||||
"@fontsource/roboto": "^5.0.13",
|
||||
"astro": "^4.16.3"
|
||||
"@astrojs/mdx": "^4.0.2",
|
||||
"@astrojs/rss": "^4.0.10",
|
||||
"@astrojs/sitemap": "^3.2.1",
|
||||
"@fontsource/roboto": "^5.1.0",
|
||||
"astro": "^5.0.4"
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ const posts = (
|
||||
<ul class="post-list">
|
||||
{posts.map((post) => (
|
||||
<li>
|
||||
<a href={`/blog/${post.slug}`}>{post.data.title}</a>
|
||||
<a href={`/blog/${post.id}`}>{post.data.title}</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
@ -1,6 +1,8 @@
|
||||
import { defineCollection, z } from 'astro:content';
|
||||
import { glob } from 'astro/loaders';
|
||||
|
||||
const blog = defineCollection({
|
||||
loader: glob({ pattern: '**/*.md', base: './src/content/blog' }),
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
description: z.string(),
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
import type { CollectionEntry } from 'astro:content';
|
||||
import { getCollection } from 'astro:content';
|
||||
import { getCollection, render } from 'astro:content';
|
||||
|
||||
import BlogPost from '../../layouts/BlogPost.astro';
|
||||
import TableOfContents from '../../components/TableOfContents.astro';
|
||||
@ -9,7 +9,7 @@ export async function getStaticPaths() {
|
||||
const posts = await getCollection('blog');
|
||||
|
||||
return posts.map((post) => ({
|
||||
params: { slug: post.slug },
|
||||
params: { slug: post.id },
|
||||
props: post
|
||||
}));
|
||||
}
|
||||
@ -17,7 +17,7 @@ export async function getStaticPaths() {
|
||||
type Props = CollectionEntry<'blog'>;
|
||||
|
||||
const post = Astro.props;
|
||||
const { Content, headings } = await post.render();
|
||||
const { Content, headings } = await render(post);
|
||||
---
|
||||
|
||||
<BlogPost {...post.data}>
|
||||
|
Loading…
Reference in New Issue
Block a user