Skip to content

Commit

Permalink
fix: allow content config in underscored dir
Browse files Browse the repository at this point in the history
  • Loading branch information
ascorbic committed Nov 25, 2024
1 parent 14feaf3 commit c479502
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/bright-keys-sell.md
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions packages/astro/src/content/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
Expand Down

0 comments on commit c479502

Please sign in to comment.