Skip to content

Commit f5ddef2

Browse files
authored
Support Astro 6 (#1534)
1 parent 744f4de commit f5ddef2

20 files changed

Lines changed: 2679 additions & 2095 deletions

File tree

.changeset/support-astro-6.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@keystatic/astro': minor
3+
---
4+
5+
Add support for Astro 6 in `peerDependencies`
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
import { defineConfig } from 'astro/config';
22
import react from '@astrojs/react';
3-
import tailwind from '@astrojs/tailwind';
3+
import tailwindcss from '@tailwindcss/vite';
44
import sitemap from '@astrojs/sitemap';
55
import markdoc from '@astrojs/markdoc';
6+
import node from '@astrojs/node';
67
import keystatic from '@keystatic/astro';
78

89
// https://astro.build/config
910
export default defineConfig({
1011
site: 'https://example.com',
11-
integrations: [tailwind(), react(), sitemap(), markdoc(), keystatic()],
12+
output: 'server',
13+
adapter: node({ mode: 'standalone' }),
14+
vite: {
15+
plugins: [tailwindcss()],
16+
},
17+
integrations: [react(), sitemap(), markdoc(), keystatic()],
1218
});

dev-projects/astro-content/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@
1111
"astro": "astro"
1212
},
1313
"dependencies": {
14-
"@astrojs/markdoc": "^0.12.9",
15-
"@astrojs/node": "^9.0.2",
16-
"@astrojs/react": "^4.2.0",
17-
"@astrojs/sitemap": "^3.2.1",
18-
"@astrojs/tailwind": "^6.0.0",
14+
"@astrojs/markdoc": "^1.0.3",
15+
"@astrojs/node": "^10.0.5",
16+
"@astrojs/react": "^5.0.3",
17+
"@astrojs/sitemap": "^3.7.2",
1918
"@keystatic/astro": "workspace:^",
2019
"@keystatic/core": "workspace:^",
21-
"@tailwindcss/typography": "^0.5.9",
20+
"@tailwindcss/typography": "^0.5.15",
21+
"@tailwindcss/vite": "^4.2.3",
2222
"@types/react": "^19.0.8",
2323
"@types/react-dom": "^19.0.3",
24-
"astro": "^5.2.5",
24+
"astro": "^6.1.8",
2525
"react": "^19.0.0",
2626
"react-dom": "^19.0.0",
27-
"tailwindcss": "^3.4.1"
27+
"tailwindcss": "^4.2.3"
2828
}
2929
}

dev-projects/astro-content/src/content/config.ts renamed to dev-projects/astro-content/src/content.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
// @ts-ignore
22
import { defineCollection, z } from 'astro:content';
3+
import { glob } from 'astro/loaders';
34

45
const blog = defineCollection({
6+
loader: glob({ pattern: '**/*.{md,mdoc}', base: './src/content/blog' }),
57
// Type-check frontmatter using a schema
68
schema: z.object({
79
title: z.string(),

dev-projects/astro-content/src/content/blog/markdown-style-guide.mdoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Itatur? Quiatae cullecum rem ent aut odis in re eossequodi nonsequ idebis ne sap
3939

4040
#### Output
4141

42-
![blog placeholder](../../../public/blog-placeholder-about.jpg)
42+
![blog placeholder](/favicon.svg)
4343

4444
## Blockquotes
4545

dev-projects/astro-content/src/layouts/Layout.astro

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
---
2+
import '../styles/global.css';
3+
24
interface Props {
35
title: string;
46
}

dev-projects/astro-content/src/pages/blog/[...slug].astro

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
---
2-
import { CollectionEntry, getCollection } from 'astro:content';
2+
import { type CollectionEntry, getCollection, render } from 'astro:content';
33
import BlogPost from '../../layouts/BlogPost.astro';
44
5+
export const prerender = true;
6+
57
export async function getStaticPaths() {
68
const posts = await getCollection('blog');
79
return posts.map(post => ({
8-
params: { slug: post.slug },
10+
params: { slug: post.id },
911
props: post,
1012
}));
1113
}
1214
type Props = CollectionEntry<'blog'>;
1315
1416
const post = Astro.props;
15-
const { Content } = await post.render();
17+
const { Content } = await render(post);
1618
---
1719

1820
<BlogPost {...post.data}>

dev-projects/astro-content/src/pages/blog/index.astro

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import { SITE_TITLE, SITE_DESCRIPTION } from '../../consts';
66
import { getCollection } from 'astro:content';
77
import FormattedDate from '../../components/FormattedDate.astro';
88
9+
export const prerender = true;
10+
911
const posts = (await getCollection('blog')).sort(
1012
(a, b) => a.data.pubDate.valueOf() - b.data.pubDate.valueOf()
1113
);
@@ -24,7 +26,7 @@ const posts = (await getCollection('blog')).sort(
2426
{
2527
posts.map(post => (
2628
<li class="text-center">
27-
<a href={`/blog/${post.slug}/`} class="group">
29+
<a href={`/blog/${post.id}/`} class="group">
2830
<img
2931
width={720}
3032
height={360}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@import 'tailwindcss';
2+
@plugin '@tailwindcss/typography';

dev-projects/astro-content/tailwind.config.cjs

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)