From 39ec3736614459cbb2c9dbcfdeb4773a08a3a9fa Mon Sep 17 00:00:00 2001 From: Le Minh Tri Date: Fri, 24 Feb 2023 13:27:33 +0700 Subject: [PATCH] feat(content): add content config --- .gitignore | 3 +++ src/content/config.ts | 16 ++++++++++++++++ src/env.d.ts | 2 ++ 3 files changed, 21 insertions(+) create mode 100644 src/content/config.ts diff --git a/.gitignore b/.gitignore index 08879b96..2eac41de 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,6 @@ pnpm-debug.log* # VSCode Workspace astro-basic-template.code-workspace + +# Astro directories +.astro diff --git a/src/content/config.ts b/src/content/config.ts new file mode 100644 index 00000000..71663c22 --- /dev/null +++ b/src/content/config.ts @@ -0,0 +1,16 @@ +import { defineCollection, z } from 'astro:content' + +const leetcodeSolutionCollection = defineCollection({ + schema: z.object({ + title: z.string(), + keywords: z.array(z.string()), + author: z.string(), + pubDate: z.string(), + difficulty: z.string(), + tags: z.array(z.string()), + }), +}) + +export const collections = { + 'leetcode-solutions': leetcodeSolutionCollection, +} diff --git a/src/env.d.ts b/src/env.d.ts index f964fe0c..6811d7c2 100644 --- a/src/env.d.ts +++ b/src/env.d.ts @@ -1 +1,3 @@ +// eslint-disable-next-line @typescript-eslint/triple-slash-reference +/// ///