21

I'm using jekyll and github pages. I'm currently busy with new post and it's not finished yet. I'm working from different places, that's why I need to push my changes to github. I created new post and push it on github. But after push my half-finished post is visible for everyone. I don't want to make it visible untill I finish it.

How I can hide it? Is there any standard way or flag?

I understand that I can copy it to another folder but it's not preffered way.

2 Answers 2

54

You can include a line in your YAML Front Matter to indicate whether a post is published or not:

published: true

or

published: false

Set published to false if you don’t want a post to show up when the site is generated.

1
  • 1
    is there something similar for pages? Commented Jul 17, 2013 at 17:37
5

Those pages are visible only if you push them on the gh-pages branch.

You could maintain a gh-pages-draft branch for you to push work in progress, and merge that branch to gh-pages when you are ready for publication.

For instance, the app middleman-deploy (for Middleman, a static site generator) recently supports pushing to other branches than just gh-pages.


Note: kleinfreund adds in the comments

The idea of drafts is backed into Jekyll.
Store post drafts in /_drafts and omit the date in the filename

This is detailed in "Working with drafts"

3
  • Thanks for your answer, but better solution in this case to use published flag. Commented Jan 21, 2013 at 18:54
  • The idea of drafts is backed into Jekyll. Store post drafts in /_drafts and omit the date in the filename: post-title.md Commented Jul 25, 2014 at 9:11
  • 1
    @kleinfreund good point. I have included your comment in the answer for more visibility, and added the link to the Jenkyll documentation.
    – VonC
    Commented Jul 25, 2014 at 9:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.