N
Nuxt4mo ago
Matt

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?
Nuxt Content
Markdown - Nuxt Content
Nuxt Content uses the Markdown syntax and conventions to provide a rich-text editing experience.
1 Reply
Matt
MattOP4mo ago
Tried adding a custom key to frontmatter.
Tried updating the file name with .draft.md. Neither seem to work. — Throwing in another directory for now… but something feels off. ☕️ kicked in. I had commas in frontmatter The value was “true,” instead of true
Want results from more Discord servers?
Add your server