nuxt-themes / alpine

The minimalist blog theme, powered by Nuxt & Markdown.
https://alpine.nuxt.space
MIT License
284 stars 57 forks source link

Markdown paratemer draft #163

Open doguskysilva opened 9 months ago

doguskysilva commented 9 months ago

When i put the parameter draft: true in markdown file, the article continue showing in articles in prod.

This should a validation in nuxt/content or alpine?

iamyuu commented 9 months ago

I think that should be part of alpine (since this is a theme)

add where on this line: https://github.com/nuxt-themes/alpine/blob/f59e470f2ef02d73864ec6ce7ad8757dfdaa4542/components/content/ArticlesList.vue#L12

moghwan commented 3 months ago

@iamyuu works fine with the need of explicitly adding the draft attribute to all posts, true or false:

https://github.com/nuxt-themes/alpine/blob/f59e470f2ef02d73864ec6ce7ad8757dfdaa4542/components/content/ArticlesList.vue#L12

here's the updated line:

const { data: _articles } = await useAsyncData('articles', async () => await queryContent(withTrailingSlash(props.path)).where({draft: false}).sort({ date: -1 }).find()) 

in your content/articles/your-post.md always add this:


# your draft posts
draft: true

# published ones
draft: false