diff --git a/frontmatter.json b/frontmatter.json index e66e96c..5d8daee 100644 --- a/frontmatter.json +++ b/frontmatter.json @@ -22,6 +22,11 @@ "default": "{{now}}", "isPublishDate": true }, + { + "title": "Draft", + "name": "draft", + "type": "draft" + }, { "title": "Categories", "name": "categories", diff --git a/src/content/blog/first-post.md b/src/content/blog/first-post.md index c30c525..f72bfc0 100644 --- a/src/content/blog/first-post.md +++ b/src/content/blog/first-post.md @@ -7,6 +7,7 @@ categories: tags: - vue - nuxt +draft: false --- ## Introduction diff --git a/src/content/config.ts b/src/content/config.ts index 8d85e7d..d8b87a2 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -4,6 +4,7 @@ const blog = defineCollection({ schema: z.object({ title: z.string(), description: z.string(), + draft: z.boolean(), pubDate: z .string() .or(z.date()) diff --git a/src/pages/blog/index.astro b/src/pages/blog/index.astro index 9e4ebc2..e784797 100644 --- a/src/pages/blog/index.astro +++ b/src/pages/blog/index.astro @@ -1,44 +1,32 @@ --- import { getCollection } from 'astro:content'; +import BaseLayout from '../../layouts/BaseLayout.astro'; -import BaseHead from '../../components/BaseHead.astro'; -import Header from '../../components/Header.astro'; -import Footer from '../../components/Footer.astro'; - -const posts = (await getCollection('blog')).sort( +const posts = (await getCollection('blog', (entry) => !entry.data.draft)).sort( (a, b) => a.data.pubDate.valueOf() - b.data.pubDate.valueOf() ); --- - - - - - - - -
-
-
-

My blog

- -
-
-