Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Markdown paratemer draft #163

Open
doguskysilva opened this issue Sep 20, 2023 · 2 comments
Open

Markdown paratemer draft #163

doguskysilva opened this issue Sep 20, 2023 · 2 comments

Comments

@doguskysilva
Copy link

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
Copy link

iamyuu commented Oct 13, 2023

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
Copy link

moghwan commented Mar 27, 2024

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants