Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow content config in underscored dir #12522

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading