@@ -2,33 +2,38 @@ import { defineCollection, z } from 'astro:content';
22import { glob , file } from 'astro/loaders' ;
33
44export const webringSchema = z . object ( {
5- name : z . string ( ) . min ( 1 , { message : "Site name has to be at least one character long!" } ) ,
6- id : z . string ( ) . min ( 1 , { message : "Site slug has to be at least one character long!" } ) . refine ( ( slug ) => {
7- const slugMatcher = / [ a - z 0 - 9 - _ .] / ;
5+ name : z . string ( ) . min ( 1 , { message : 'Site name has to be at least one character long!' } ) ,
6+ id : z
7+ . string ( )
8+ . min ( 1 , { message : 'Site slug has to be at least one character long!' } )
9+ . refine ( ( slug ) => {
10+ const slugMatcher = / [ a - z 0 - 9 - _ .] / ;
811
9- if ( slugMatcher . test ( slug ) ) return true ;
12+ if ( slugMatcher . test ( slug ) ) return true ;
1013
11- return " Slug must be in all lowercase and include only numbers, letters from a-z, hyphens, dots and underscores." ;
12- } ) ,
13- url : z . string ( ) . url ( { message : " Site url must be valid" } )
14+ return ' Slug must be in all lowercase and include only numbers, letters from a-z, hyphens, dots and underscores.' ;
15+ } ) ,
16+ url : z . string ( ) . url ( { message : ' Site url must be valid' } ) ,
1417} ) ;
1518
1619const webring_friendsOfHouston = defineCollection ( {
17- loader : glob ( { pattern : " *.json" , base : " ./src/content/rings/friends-of-houston" } ) ,
18- schema : webringSchema
20+ loader : glob ( { pattern : ' *.json' , base : ' ./src/content/rings/friends-of-houston' } ) ,
21+ schema : webringSchema ,
1922} ) ;
2023
2124const webring_builtWithAstro = defineCollection ( {
22- loader : glob ( { pattern : " *.json" , base : " ./src/content/rings/built-with-astro" } ) ,
23- schema : webringSchema
25+ loader : glob ( { pattern : ' *.json' , base : ' ./src/content/rings/built-with-astro' } ) ,
26+ schema : webringSchema ,
2427} ) ;
2528
2629const webrings = defineCollection ( {
27- loader : file ( " src/content/rings/rings.json" ) ,
30+ loader : file ( ' src/content/rings/rings.json' ) ,
2831 schema : z . object ( {
29- collection : z . string ( ) . min ( 1 , { message : "Webring collection name needs to be at least one character long!" } ) ,
30- slug : z . string ( ) . min ( 1 , { message : "Webring slug needs to be at least one character long!" } ) ,
31- } )
32+ collection : z
33+ . string ( )
34+ . min ( 1 , { message : 'Webring collection name needs to be at least one character long!' } ) ,
35+ slug : z . string ( ) . min ( 1 , { message : 'Webring slug needs to be at least one character long!' } ) ,
36+ } ) ,
3237} ) ;
3338
3439export const collections = {
0 commit comments