Skip to content

Commit 66198a1

Browse files
committed
add GenerateIdFn type
1 parent 5955884 commit 66198a1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/content/config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@ import { BASE_FOLDERS } from '@/constants/collections';
77

88
const { POST, PROJECT } = BASE_FOLDERS;
99

10+
type GenerateIdFn = Parameters<typeof glob>[0]['generateId'];
11+
1012
/**
1113
* Format id slug. Remove '/' to avoid catch all [...page].astro route.
1214
*
1315
* @example filepath: 2024/03-15-example-project-2/index.mdx -> slug: 2024-03-15-example-project-2
1416
*/
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('-');
1619

1720
export const postCollection = defineCollection({
1821
loader: glob({ pattern: '**/*.mdx', base: POST, generateId }),

0 commit comments

Comments
 (0)