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.

hong
  • 95
  • 2
  • 15
Viacheslav Kondratiuk
  • 8,493
  • 9
  • 49
  • 81

2 Answers2

53

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.

James Chevalier
  • 10,604
  • 5
  • 48
  • 74
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"

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250