diff --git a/.changeset/bright-keys-sell.md b/.changeset/bright-keys-sell.md new file mode 100644 index 0000000000..0222aaf51c --- /dev/null +++ b/.changeset/bright-keys-sell.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fixes a bug where content config was ignored if it was outside of content dir and has a parent dir with an underscore diff --git a/packages/astro/src/content/utils.ts b/packages/astro/src/content/utils.ts index 1cdafa1907..16d703fc78 100644 --- a/packages/astro/src/content/utils.ts +++ b/packages/astro/src/content/utils.ts @@ -421,14 +421,14 @@ export function getEntryType( const { ext } = path.parse(entryPath); const fileUrl = pathToFileURL(entryPath); - if (hasUnderscoreBelowContentDirectoryPath(fileUrl, paths.contentDir)) { + if (fileUrl.href === paths.config.url.href) { + return 'config'; + } else if (hasUnderscoreBelowContentDirectoryPath(fileUrl, paths.contentDir)) { return 'ignored'; } else if (contentFileExts.includes(ext)) { return 'content'; } else if (dataFileExts.includes(ext)) { return 'data'; - } else if (fileUrl.href === paths.config.url.href) { - return 'config'; } else { return 'ignored'; }