diff --git a/.changeset/yellow-insects-tell.md b/.changeset/yellow-insects-tell.md new file mode 100644 index 000000000000..576ae3a18213 --- /dev/null +++ b/.changeset/yellow-insects-tell.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fix: ignore `.json` files nested in subdirectories within content collection directories starting with an `_` underscore. diff --git a/packages/astro/src/content/vite-plugin-content-virtual-mod.ts b/packages/astro/src/content/vite-plugin-content-virtual-mod.ts index 021a26314b72..d7924973cc24 100644 --- a/packages/astro/src/content/vite-plugin-content-virtual-mod.ts +++ b/packages/astro/src/content/vite-plugin-content-virtual-mod.ts @@ -213,7 +213,7 @@ function globWithUnderscoresIgnored(relContentDir: string, exts: string[]): stri const contentDir = appendForwardSlash(relContentDir); return [ `${contentDir}**/*${extGlob}`, - `!${contentDir}**/_*/**${extGlob}`, + `!${contentDir}**/_*/**/*${extGlob}`, `!${contentDir}**/_*${extGlob}`, ]; } diff --git a/packages/astro/test/fixtures/content-collections/src/content/with-schema-config/_ignore/ignore/file.md b/packages/astro/test/fixtures/content-collections/src/content/with-schema-config/_ignore/ignore/file.md new file mode 100644 index 000000000000..e69de29bb2d1