How to make my post not public for a while?
Asked Answered
T

2

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.

Trescott answered 20/1, 2013 at 18:56 Comment(0)
P
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.

Putty answered 21/1, 2013 at 14:37 Comment(1)
is there something similar for pages?Bolick
J
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"

Jacobjacoba answered 21/1, 2013 at 7:0 Comment(3)
Thanks for your answer, but better solution in this case to use published flag.Trescott
The idea of drafts is backed into Jekyll. Store post drafts in /_drafts and omit the date in the filename: post-title.mdMethadone
@Methadone good point. I have included your comment in the answer for more visibility, and added the link to the Jenkyll documentation.Jacobjacoba

© 2022 - 2024 — McMap. All rights reserved.