feat(content): add draft support for content collections

This commit introduces a draft system for the 'events' and 'news' collections. A `draft` boolean field has been added to the content schema, and frontend queries are now updated to only fetch and
display content where `draft` is `false`. This allows content to be created and saved without being publicly visible, improving the publishing workflow.
This commit is contained in:
xiaomai
2025-11-15 17:58:00 +08:00
parent c7da09d327
commit 6288a1b01b
8 changed files with 2062 additions and 1868 deletions

View File

@@ -31,7 +31,11 @@
<script lang="ts" setup>
const { data: events } = await useAsyncData("events", () =>
queryCollection("events").order("date", "DESC").limit(3).all()
queryCollection("events")
.where("draft", "=", false)
.order("date", "DESC")
.limit(3)
.all()
);
</script>