From a0825a9846f69ab8aebf59c2bf5f82b3f7f6202c Mon Sep 17 00:00:00 2001 From: sushichan044 Date: Sat, 21 Dec 2024 16:33:38 +0900 Subject: [PATCH] fix: enable legacy collection --- packages/sushichan.live/astro.config.ts | 3 +++ packages/sushichan.live/src/content/config.ts | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/sushichan.live/astro.config.ts b/packages/sushichan.live/astro.config.ts index 279de9a..b0110fd 100644 --- a/packages/sushichan.live/astro.config.ts +++ b/packages/sushichan.live/astro.config.ts @@ -82,6 +82,9 @@ export default defineConfig({ react(), tailwind(), ], + legacy: { + collections: true, + }, markdown: { gfm: true, rehypePlugins: [rehypeUnwrapImages, rehypeKatex], diff --git a/packages/sushichan.live/src/content/config.ts b/packages/sushichan.live/src/content/config.ts index 2638e04..61ed45e 100644 --- a/packages/sushichan.live/src/content/config.ts +++ b/packages/sushichan.live/src/content/config.ts @@ -1,5 +1,4 @@ import { cldAssetsLoader } from "astro-cloudinary/loaders"; -import { glob } from "astro/loaders"; import { defineCollection, reference, z } from "astro:content"; const baseSchema = z.object({ @@ -19,9 +18,11 @@ const blogSpecificSchema = z.object({ const blogSchema = baseSchema.merge(blogSpecificSchema); +// see: https://github.com/withastro/astro/issues/12784 +// somehow new glob loader is broken const posts = defineCollection({ - loader: glob({ base: "./src/content/posts", pattern: "**/*.mdx?" }), schema: blogSchema, + type: "content", }); const cldImages = defineCollection({