vuejs / vuepress

📝 Minimalistic Vue-powered static site generator
https://vuepress.vuejs.org
MIT License
22.58k stars 4.76k forks source link

Should implement `publish: true/false` in frontmatter #2238

Open franklinqin0 opened 4 years ago

franklinqin0 commented 4 years ago

Feature request

What problem does this feature solve?

Users have an easier time deciding if they want to publish an article

What does the proposed API look like?

If a user doesn't want to publish an article, can set in frontmatter:

---
publish: false
---

How should this be implemented in your opinion?

Not sure.

Are you willing to work on this yourself?

Maybe when I have more in-depth knowledge of Vue.js

billyyyyy3320 commented 4 years ago

Relevant issue #1558

axelitus commented 4 years ago

I'm building a blog and I thought this was already a feature so I put a published: false attribute in frontmatter and figured it didn't work. I hope this gets added soon-ish because it would make "posts in writing progress" possible. Right now, the way I think I could handle it is having a separate branch in the repo for them.

axelitus commented 4 years ago

Is there any way to tap into the resolved pages before building the site and remove any pages that match certain criteria?

Where in the lifecycle could we do this and is there an API/hook to achieve this?

franklinqin0 commented 4 years ago

Is there any way to tap into the resolved pages before building the site and remove any pages that match certain criteria?

Where in the lifecycle could we do this and is there an API/hook to achieve this?

There is actually a VuePress blog theme that did this already. If you are interested, here is the link.

Maybe you could implement a similar thing yourself!

axelitus commented 4 years ago

Thanks for your response @franklinqin0. I took a look at the theme and it is filtering the posts "frontend-wise", I already have this in my vuepress site. What I would like is to tap into the build process and filter out some docs that contain certain frontmatter option values to not even build those files.

Currently, even though in the frontend these posts are not being displayed as available, I can navigate to them using the permalink, that is what I want to avoid.