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

Add "draft" variable to front-matter to control if article is a draft like hugo #5122

Closed
2 tasks done
suncle1993 opened this issue Dec 4, 2022 · 8 comments
Closed
2 tasks done

Comments

@suncle1993
Copy link

suncle1993 commented Dec 4, 2022

Check List

Please check followings before submitting a new feature request.

  • I have already read Docs page
  • I have already searched existing issues

Feature Request

an example front-matter:

---
date: '2022-12-04T18:31:37'
abbrlink: 1358609975
draft: true
---

if draft is true, this article will not be rendered, just like article file in _draft directory

Others

@WangNianyi2001
Copy link

If you really need this feature ASAP, you can customize the .ejs files in your theme to get a workaround. Just look for where the posts are iterated (usually with site.posts), add a filter after that and it's done.

@SukkaW
Copy link
Member

SukkaW commented Mar 3, 2023

Just curious. Is there any reason that you don't want to use the draft folders?

@WangNianyi2001
Copy link

@SukkaW My guess is that sometimes people (like me) organize published posts in separated folders under _posts. Using _drafts folder then publishing them via CLI will not do the classification job automatically.

@suncle1993
Copy link
Author

@SukkaW My guess is that sometimes people (like me) organize published posts in separated folders under _posts. Using _drafts folder then publishing them via CLI will not do the classification job automatically.

Yes, you are right. This is indeed my scene. I need to write and organize a series of articles in seperated folders under _posts.

@stevenjoezhang
Copy link
Member

@suncle1993 @WangNianyi2001 You can set published: false in Front-matter. It's an undocumented feature.

@suncle1993
Copy link
Author

@suncle1993 @WangNianyi2001 You can set published: false in Front-matter. It's an undocumented feature.

I will try this magic feature. Thank you.

@stevenjoezhang
Copy link
Member

If you confirm that this feature meets your expectations, I will update the documentation.

@suncle1993
Copy link
Author

If you confirm that this feature meets your expectations, I will update the documentation.

after add published: false to Front-matter, it take effect. Thank you.

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

4 participants