Upgrades to Astro 5
This commit is contained in:
4254
package-lock.json
generated
4254
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -8,14 +8,14 @@
|
||||
"astro": "cd website && astro"
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/rss": "^4.0.5",
|
||||
"@astrojs/sitemap": "^3.1.2",
|
||||
"astro": "^4.11.5",
|
||||
"@astrojs/rss": "^4.0.10",
|
||||
"@astrojs/sitemap": "^3.2.1",
|
||||
"astro": "^5.1.1",
|
||||
"markdown-it": "^14.1.0",
|
||||
"typescript": "^5.4.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@astrojs/check": "^0.5.10",
|
||||
"@astrojs/check": "^0.9.4",
|
||||
"@types/markdown-it": "^14.1.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { glob } from 'astro/loaders';
|
||||
import { defineCollection, z } from 'astro:content';
|
||||
|
||||
const blog = defineCollection({
|
||||
type: 'content',
|
||||
schema: z.object({
|
||||
loader: glob({ pattern: '**/*.(md|mdx|html)', base: './src/content/blog' }),
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
hidden: z.optional(z.boolean()),
|
||||
description: z.string(),
|
||||
@@ -1,18 +1,18 @@
|
||||
---
|
||||
import { type CollectionEntry, getCollection } from 'astro:content';
|
||||
import { type CollectionEntry, getCollection, render } from 'astro:content';
|
||||
import BlogPost from '../../layouts/BlogPost.astro';
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const posts = await getCollection('blog');
|
||||
return posts.map((post) => ({
|
||||
params: { slug: post.slug },
|
||||
params: { slug: post.id },
|
||||
props: post,
|
||||
}));
|
||||
}
|
||||
type Props = CollectionEntry<'blog'>;
|
||||
|
||||
const post = Astro.props;
|
||||
const { Content } = await post.render();
|
||||
const { Content } = await render(post);
|
||||
---
|
||||
|
||||
<BlogPost {...post.data}>
|
||||
|
||||
@@ -23,9 +23,9 @@ export async function GET(context: APIContext) {
|
||||
site: path.join(site.toString(), 'blog'),
|
||||
trailingSlash: false,
|
||||
items: posts.map((post) => ({
|
||||
link: `/blog/${post.slug}`,
|
||||
link: `/blog/${post.id}`,
|
||||
title: post.data.title,
|
||||
content: mdParser.render(post.body),
|
||||
content: mdParser.render(post.body ?? ''),
|
||||
pubDate: post.data.pubDate,
|
||||
description: post.data.description,
|
||||
author: 'Joe Carstairs',
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
{
|
||||
"extends": "astro/tsconfigs/strict",
|
||||
"compilerOptions": {
|
||||
"strictNullChecks": true
|
||||
}
|
||||
"strictNullChecks": true
|
||||
},
|
||||
"include": [
|
||||
".astro/types.d.ts",
|
||||
"**/*"
|
||||
],
|
||||
"exclude": ["dist"]
|
||||
}
|
||||
Reference in New Issue
Block a user