File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -7,12 +7,15 @@ import { BASE_FOLDERS } from '@/constants/collections';
7
7
8
8
const { POST , PROJECT } = BASE_FOLDERS ;
9
9
10
+ type GenerateIdFn = Parameters < typeof glob > [ 0 ] [ 'generateId' ] ;
11
+
10
12
/**
11
13
* Format id slug. Remove '/' to avoid catch all [...page].astro route.
12
14
*
13
15
* @example filepath: 2024/03-15-example-project-2/index.mdx -> slug: 2024-03-15-example-project-2
14
16
*/
15
- const generateId = ( { entry } : { entry : string } ) => entry . split ( '/' ) . slice ( 0 , 2 ) . join ( '-' ) ;
17
+ const generateId : GenerateIdFn = ( { entry } : { entry : string } ) =>
18
+ entry . split ( '/' ) . slice ( 0 , 2 ) . join ( '-' ) ;
16
19
17
20
export const postCollection = defineCollection ( {
18
21
loader : glob ( { pattern : '**/*.mdx' , base : POST , generateId } ) ,
You can’t perform that action at this time.
0 commit comments