-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix error in empty markdown files with content (#6572)
* test: add test fixture * test: add test case * 🤏 fix * chore: changeset --------- Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
- Loading branch information
1 parent
66858f1
commit fa132e3
Showing
8 changed files
with
55 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
Properly handle empty markdown files in content collections |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
packages/astro/test/fixtures/content-collections-empty-md-file/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "@test/content-collections-empty-md-file", | ||
"version": "0.0.0", | ||
"private": true, | ||
"type": "module", | ||
"dependencies": { | ||
"astro": "workspace:*" | ||
} | ||
} |
Empty file.
11 changes: 11 additions & 0 deletions
11
packages/astro/test/fixtures/content-collections-empty-md-file/src/content/config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { z, defineCollection } from 'astro:content'; | ||
|
||
const blog = defineCollection({ | ||
schema: z.object({ | ||
title: z.string(), | ||
}), | ||
}); | ||
|
||
export const collections = { | ||
blog, | ||
}; |
6 changes: 6 additions & 0 deletions
6
packages/astro/test/fixtures/content-collections-empty-md-file/src/pages/index.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
import { getEntryBySlug } from 'astro:content'; | ||
const blogEntry = await getEntryBySlug('blog', 'empty'); | ||
--- | ||
|
||
{blogEntry.data.title} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.