11import { defineCollection } from 'astro:content' ;
22import { file , glob } from 'astro/loaders' ;
33import { z } from 'astro/zod' ;
4- import authors from '.. /data/authors/authors.json' ;
4+ import authors from './data/authors/authors.json' ;
55
66export const IntegrationCategories = new Map ( [
77 [ 'recent' , 'Recently Added' ] ,
@@ -53,6 +53,7 @@ export const collections = {
5353 . strict ( ) ,
5454 } ) ,
5555 blog : defineCollection ( {
56+ loader : glob ( { base : './src/content/blog' , pattern : '*.mdx' } ) ,
5657 schema : z . object ( {
5758 title : z . string ( ) . describe ( 'The blog post title.' ) ,
5859 description : z
@@ -101,6 +102,7 @@ export const collections = {
101102 } ) ,
102103 } ) ,
103104 caseStudies : defineCollection ( {
105+ loader : glob ( { base : './src/content/caseStudies' , pattern : '*.mdx' } ) ,
104106 schema : z
105107 . object ( {
106108 seo : seoSchema . optional ( ) ,
@@ -119,6 +121,7 @@ export const collections = {
119121 . transform ( ( study ) => ( { ...study , isCaseStudy : true } ) ) ,
120122 } ) ,
121123 integrations : {
124+ loader : glob ( { base : './src/content/integrations' , pattern : '*.md' } ) ,
122125 schema : z . object ( {
123126 name : z . string ( ) . describe ( 'Name of the package as it is published to NPM' ) ,
124127 title : z
@@ -140,6 +143,7 @@ export const collections = {
140143 } ) ,
141144 } ,
142145 pages : defineCollection ( {
146+ loader : glob ( { base : './src/content/pages' , pattern : '**/*.md' } ) ,
143147 schema : ( { image } ) =>
144148 z . discriminatedUnion ( 'pageLayout' , [
145149 z . object ( {
@@ -157,9 +161,11 @@ export const collections = {
157161 ] ) ,
158162 } ) ,
159163 partials : {
164+ loader : glob ( { base : './src/content/partials' , pattern : '*.md' } ) ,
160165 schema : z . object ( { } ) ,
161166 } ,
162167 quotes : {
168+ loader : glob ( { base : './src/content/quotes' , pattern : '*.md' } ) ,
163169 schema : z . object ( {
164170 author : z . object ( {
165171 handle : z . string ( ) ,
@@ -173,7 +179,13 @@ export const collections = {
173179 } ) ,
174180 } ,
175181 showcase : defineCollection ( {
176- type : 'data' ,
182+ loader : glob ( {
183+ base : './src/content/showcase' ,
184+ pattern : '*.yml' ,
185+ // Showcase filenames are based on the site URL, and we don’t want Astro to strip out periods,
186+ // so we just remove the file extension and otherwise do nothing.
187+ generateId : ( { entry } ) => entry . split ( '.' ) . slice ( 0 , - 1 ) . join ( '.' ) ,
188+ } ) ,
177189 schema : ( { image } ) =>
178190 z . object ( {
179191 title : z
0 commit comments