0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-03-24 23:21:57 -05:00

[docs] pattern to preserve ignoring files prefixed with an underscore (#11749)

* [docs] `pattern` to preserve ignoring files prefixed with an underscore

* simplify examples with only md not mdx

Co-authored-by: Matt Kane <m@mk.gg>

* remove strange line full of tabs

* Update packages/astro/src/@types/astro.ts

* Apply suggestions from code review

* fix regex

---------

Co-authored-by: Matt Kane <m@mk.gg>
Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
This commit is contained in:
Sarah Rainsberger 2024-08-19 12:27:12 -03:00 committed by GitHub
parent b67742961a
commit ad919776ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2275,6 +2275,10 @@ export interface AstroUserConfig {
* export const collections = { blog, dogs };
* ```
*
* :::note
* Loaders will not automatically [exclude files prefaced with an `_`](/en/guides/routing/#excluding-pages). Use a regular expression such as `pattern: '**\/[^_]*.md` in your loader to ignore these files.
* :::
*
* #### Querying and rendering with the Content Layer API
*
* The collection can be [queried in the same way as content collections](/en/guides/content-collections/#querying-collections):
@ -2356,7 +2360,7 @@ export interface AstroUserConfig {
* const blog = defineCollection({
* // For content layer you no longer define a `type`
* type: 'content',
* loader: glob({ pattern: "**\/*.md", base: "./src/data/blog" }),
* loader: glob({ pattern: '**\/[^_]*.md', base: "./src/data/blog" }),
* schema: z.object({
* title: z.string(),
* description: z.string(),