Skip to content

Commit

Permalink
fix drafted posts
Browse files Browse the repository at this point in the history
  • Loading branch information
noghartt committed Nov 20, 2024
1 parent 595357b commit b8ff610
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/content/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const blogCollection = defineCollection({
.object({
title: z.string(),
pubDate: z.coerce.date(),
tags: z.array(z.string()).optional(),
tags: z.array(z.string()).default([]).optional(),
draft: z.boolean().optional(),
})
.merge(rssSchema)
Expand Down
3 changes: 1 addition & 2 deletions src/pages/tag/[tag].astro
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import type { CollectionEntry } from 'astro:content';
import type { GetStaticPathsResult } from 'astro';
import Layout from '../../layout/Layout.astro';
import Link from '../../components/Link.astro';
import Posts from '../../components/Posts.astro';
import GoBackButton from '../../components/GoBackButton.astro';
Expand All @@ -14,7 +13,7 @@ interface Props {
export const prerender = true;
export async function getStaticPaths(): Promise<GetStaticPathsResult> {
const posts = await getCollection('blog');
const posts = await getCollection('blog', (post) => !post.data.draft);
const existentTags = posts.reduce(
(tags, post) => new Set([...tags, ...post.data.tags || []]),
Expand Down

0 comments on commit b8ff610

Please sign in to comment.