From 33b0e305fe4ecabc30ffa823454395c973f92454 Mon Sep 17 00:00:00 2001 From: Matt Kane Date: Mon, 25 Nov 2024 13:59:31 +0000 Subject: [PATCH] fix: allow content config in underscored dir (#12522) --- .changeset/bright-keys-sell.md | 5 +++++ packages/astro/src/content/utils.ts | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 .changeset/bright-keys-sell.md 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'; }