Matt
Matt
NNuxt
Created by Matt on 9/5/2024 in #❓・help
issues with _draft
Hey all, I'm using Nuxt Content/Studio and feel like I'm missing something in the Docs for _draft posts. https://content.nuxt.com/usage/markdown#front-matter Looking at the docs here, it seems I can pass draft: true to hide the post in Production. However, on my page I'm still seeing the post. I've tried passing both draft and _draft Inspecting the payload I DO see _draft: true for that specific post. Is there another piece to this I may be missing? I've tried adding to the query below as well - but no luck so far. Again, the post payload seems correct -- but I can't put my finger on why it’s not filtering out.
const { data: posts } = await useAsyncData('posts', () => {
const query = queryContent('blog')
.where({ _draft: { $ne: true } })
.sort({ ... })
.limit(limit)
.skip(skip)
.find()

return query;
}
const { data: posts } = await useAsyncData('posts', () => {
const query = queryContent('blog')
.where({ _draft: { $ne: true } })
.sort({ ... })
.limit(limit)
.skip(skip)
.find()

return query;
}
Would it be easier to make a custom key in frontmatter for my query?
3 replies