"Drafts" implementation?

194 views
Skip to first unread message

Nate

unread,
Jan 20, 2011, 12:40:49 PM1/20/11
to jekyll.rb
I just started blogging using Jekyll, and was wondering how other
people
implement drafts?

For example, I start a blog topic on Wednesday, but I don't want to
publish it yet.

Seems like a simple _drafts directory would be a good solution, except
that the _drafts
directory doesn't show up in preview/server mode.

Is there a config / command line setting to tell jekyll to consider a
_drafts directory? Then, I could run jekyll --server --auto --
additional-dirs _drafts when I'm editing, and then omit the _drafts
directory when publishing.

I thought about using a git branch and putting the draft in my _posts
directory, but this seems a bit tricky, as I'd have to remember to
push the separate branch if I wanted to edit the draft
from another machine.

Thanks,
--Nate

Tom Werner

unread,
Jan 20, 2011, 7:04:43 PM1/20/11
to jeky...@googlegroups.com
I have a _drafts directory that I put my drafts in while I work on
them. I usually don't have very many images or fancy markup so it
doesn't bother me to just write in my editor until I'm almost ready to
publish. It might be nice to have a --drafts switch that just picks up
and publishes stuff in a _drafts directory if it exists. I'll put that
on my list to consider for the next release.

Tom

> --
> You received this message because you are subscribed to the Google Groups "jekyll.rb" group.
> To post to this group, send email to jeky...@googlegroups.com.
> To unsubscribe from this group, send email to jekyll-rb+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/jekyll-rb?hl=en.
>
>

--
Tom Preston-Werner
github.com/mojombo

Corin

unread,
Jan 20, 2011, 7:46:40 PM1/20/11
to jekyll.rb
Afraid I'm not up to hacking Jekyll itself, but here's a simple bash
script that might help.

http://pastie.org/pastes/1482873/text

Basically it edits your config file to remove the destination setting
(so that when you run jekyll, it won't update your live site), it adds
symbolic links so that everything in _drafts is linked to from _posts,
then it loads up Jekyll with the local server option (available by
default on http://127.0.0.1:4000), when I'm working on the site it's
through a PuTTY terminal so I enable tunnelling, meaning I can view
that local URL through my Windows browser. When you ctrl+C to end the
Jekyll process, it then undoes the changes.

Works great for me (though admitedly, if Tom does add it to a future
release it would be a simpler and nicer solution).

Corin
> > For more options, visit this group athttp://groups.google.com/group/jekyll-rb?hl=en.
>
> --
> Tom Preston-Werner
> github.com/mojombo

Krzysztof Wojciechowski

unread,
Jan 21, 2011, 8:51:36 AM1/21/11
to jeky...@googlegroups.com
Why do you make it so problematic? Can't you just use the "published" entry in the YAML Front Matter? More information is here: https://github.com/mojombo/jekyll/wiki/YAML-Front-Matter
Cheers,
-- Kwpolska (http://kwpolska.co.cc)

Corin

unread,
Jan 21, 2011, 8:57:36 AM1/21/11
to jekyll.rb
The OP's question was how to view the draft as part of his site using
Jekyll's --server option, without having it also go live on the real
website.

Using "published: false" in the post means it won't show up in the --
server version of the site either, so it's no more useful than just
having the post stored in a different directory.

Corin

On Jan 21, 1:51 pm, Krzysztof Wojciechowski <kwpol...@gmail.com>
wrote:
> Why do you make it so problematic? Can't you just use the "published" entry
> in the YAML Front Matter? More information is here:https://github.com/mojombo/jekyll/wiki/YAML-Front-Matter
> Cheers,
> -- Kwpolska (http://kwpolska.co.cc)
>
> On Fri, Jan 21, 2011 at 1:46 AM, Corin <corin.c.c...@gmail.com> wrote:
> > Afraid I'm not up to hacking Jekyll itself, but here's a simple bash
> > script that might help.
>
> >http://pastie.org/pastes/1482873/text
>
> > Basically it edits your config file to remove the destination setting
> > (so that when you run jekyll, it won't update your live site), it adds
> > symbolic links so that everything in _drafts is linked to from _posts,
> > then it loads up Jekyll with the local server option (available by
> > default onhttp://127.0.0.1:4000), when I'm working on the site it's
> > jekyll-rb+...@googlegroups.com<jekyll-rb%2Bunsu...@googlegroups.com>
> > .
> > > > For more options, visit this group athttp://
> > groups.google.com/group/jekyll-rb?hl=en.
>
> > > --
> > > Tom Preston-Werner
> > > github.com/mojombo
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "jekyll.rb" group.
> > To post to this group, send email to jeky...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > jekyll-rb+...@googlegroups.com<jekyll-rb%2Bunsu...@googlegroups.com>
> > .

Nathan Neff

unread,
Jan 21, 2011, 10:06:09 AM1/21/11
to jeky...@googlegroups.com
On Fri, Jan 21, 2011 at 7:51 AM, Krzysztof Wojciechowski
<kwpo...@gmail.com> wrote:
> Why do you make it so problematic? Can't you just use the "published" entry
> in the YAML Front Matter? More information is
> here: https://github.com/mojombo/jekyll/wiki/YAML-Front-Matter

This works good -- thanks for the heads-up. The only "bad" part is
that I'll have published : true when working on the draft, to preview
it. When I'm done working on the draft for the day, I will change
published back to false. It's a bit off the exact path, but it will
definitely work -- thanks again!

Also, I think that my need for seeing "previews" of my blog will
diminish once I iron out the styling and post more articles.

Thanks,


--Nate

Noufal Ibrahim

unread,
Jan 21, 2011, 4:02:30 AM1/21/11
to jeky...@googlegroups.com
On Thu, Jan 20 2011, Nate wrote:

> I just started blogging using Jekyll, and was wondering how other
> people implement drafts?

I wrote an Emacs mode to create my Jekyll blog posts.
https://github.com/nibrahim/Hyde

It doesn't support proper previews (yet). It does have direct markdown
previews though (no liquid tags etc.) so you can alteast check your
markup. It integrates with git so adding, committing are done by the
backend when posts transition from draft to published to deployed.

I recently added drafts support. It's a little unpolished but I use it
with my blog. Basically, new posts are put into the _drafts directory
unless you explicity "promote" them.

If you're an Emacs user, it *might* help you.

[...]


--

Corin

unread,
Jan 21, 2011, 9:28:15 AM1/21/11
to jekyll.rb
Setting "published: false" will stop the post from showing up even in
the local --server version of the site, so it wouldn't help preview a
post. Basically it's not more useful than storing the post in a
different directory elsewhere.

Corin

On Jan 21, 1:51 pm, Krzysztof Wojciechowski <kwpol...@gmail.com>
wrote:
> Why do you make it so problematic? Can't you just use the "published" entry
> in the YAML Front Matter? More information is here:https://github.com/mojombo/jekyll/wiki/YAML-Front-Matter
> Cheers,
> -- Kwpolska (http://kwpolska.co.cc)
>
> On Fri, Jan 21, 2011 at 1:46 AM, Corin <corin.c.c...@gmail.com> wrote:
> > Afraid I'm not up to hacking Jekyll itself, but here's a simple bash
> > script that might help.
>
> >http://pastie.org/pastes/1482873/text
>
> > Basically it edits your config file to remove the destination setting
> > (so that when you run jekyll, it won't update your live site), it adds
> > symbolic links so that everything in _drafts is linked to from _posts,
> > then it loads up Jekyll with the local server option (available by
> > default onhttp://127.0.0.1:4000), when I'm working on the site it's
> > jekyll-rb+...@googlegroups.com<jekyll-rb%2Bunsu...@googlegroups.com>
> > .
> > > > For more options, visit this group athttp://
> > groups.google.com/group/jekyll-rb?hl=en.
>
> > > --
> > > Tom Preston-Werner
> > > github.com/mojombo
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "jekyll.rb" group.
> > To post to this group, send email to jeky...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > jekyll-rb+...@googlegroups.com<jekyll-rb%2Bunsu...@googlegroups.com>
> > .

Nathan Neff

unread,
Jan 25, 2011, 5:32:08 AM1/25/11
to jeky...@googlegroups.com
On Fri, Jan 21, 2011 at 7:57 AM, Corin <corin....@gmail.com> wrote:
> The OP's question was how to view the draft as part of his site using
> Jekyll's --server option, without having it also go live on the real
> website.
>
> Using "published: false" in the post means it won't show up in the --
> server version of the site either, so it's no more useful than just
> having the post stored in a different directory.

It's more useful than storing a post in a different directory, because I only
need to change published : true to see the post during development, then
set it to published : false if I have to postpone publishing. This works for
me, because when I want to publish, I run jekyll --pygments, then rsync the
_site directory to my public directory on my server.

It's better than putting the post in a different directory, because I
can at least
see the preview without having to juggle the file between the _posts
directory and some
_drafts directory /and/ set published:false/true. I only need to
change published:false,
and when I publish I don't have to worry about using "git mv
_drafts/2011-01-01_foo.md _posts/2011-01-01_foo.md"

--Nate

> To unsubscribe from this group, send email to jekyll-rb+...@googlegroups.com.

lucapette

unread,
Feb 14, 2011, 6:04:22 AM2/14/11
to jeky...@googlegroups.com
This is a great idea. I switched to jekyll recently and this is the only thing I'd miss while using it.
Reply all
Reply to author
Forward
0 new messages