Updated Jekyll

Not that long ago Jekyll be­come that big —ver­sion “1.0” was re­leased.

There are a lot of stuff in the changelog: there are new fea­tures, there are a lot of fixes. You can read what's the most im­por­tant in this ar­ti­cle.

I moved my site to this ver­sion. Well, not ac­tu­ally moved —every­thing worked any­way, but there were some stuff in a new ver­sion that I could use to make things in a bet­ter way. So, I'll write a bit on what I per­son­ally liked in this new version.

page.path

It's one of those things I wanted the Jekyll to have —I even pinged de­vel­op­ers a bit in a cor­re­spond­ing is­sue at GitHub.

Old ver­sion of Jekyll had one flaw: there were no ways to re­trieve the path of the source files for pages or blog posts. Why is this im­por­tant? The blog or a site that's hosted at GitHub would profit a lot from giv­ing a way for its users to edit the con­tent. To make it re­ally easy it would be handy to pro­vide a link that would go ei­ther straight to the GitHub's edit file page, or at any other ser­vice that pro­vides such pos­si­bil­ity, like prose.io (which I use). This link would need to have the url to the source en­coded in it; with­out proper method to do it there were only the dirt­i­est hacks avail­able to im­ple­ment this be­havior.

And now it be­came re­ally sim­ple —the data of the posts and pages now con­tains the path vari­able, which con­tains the path to the source of the page. Hooray!

Perma­links set in YAML front mat­ter were rel­a­tive be­fore. Even more, you couldn't set them to point at the up­per lev­els, like us­ing ../ (or I couldn't find how to make it work). But in a new Jekyll you could use ab­solute perma­links. Ac­tu­ally, right now, in 1.0, you need to en­able them in the con­fig us­ing rel­a­tive_perma­links:false, but with 1.1 this would be the de­fault be­hav­ior. So, if you're us­ing rel­a­tive perma­links now and don't want them to be­come ab­solute at one mo­ment, you'll need to ei­ther change them to ab­solute ones, or just set the rel­a­tive_perma­links:true, so noth­ing would go wrong when 1.1 would be there.

Ab­solute perma­links made a lot of things eas­ier for me —I could move all in­dex pages for cat­e­gories etc. to a sin­gle folder, for ex­ample.

Changed syntax in CLI

New Jekyll comes with changed syn­tax in CLI, and one of the most in­ter­est­ing fea­tures is an abil­ity to use ad­di­tional configs.

If you'd like to run Jekyll with both the de­fault con­fig _con­fig.yml and an ex­tra one, like _con­fig-dev.yml, you could run Jekyll this way:

jekyll serve --config _config.yml,_config-dev.yml

Us­ing this you could eas­ily set up the dev en­vi­ron­ment, where you could change the ab­solute urls to be lo­cal­host, turn on the dis­play of the drafts and do any­thing ex­tra that won't show up in the pro­duction.

Drafts

In new Jekyll you could cre­ate proper drafts. If you'd cre­ate a _drafts folder, its con­tent won't ren­der by de­fault, but if you'd run your lo­cal copy with --drafts key in CLI, the con­tent of the drafts would be ren­dered like if it had been placed in the _posts di­rec­tory. One use­ful thing here is that you won't need to set the date in the posts' file­name, and when you'd need to pub­lish the draft you'll just need move the post from the _drafts to the _posts and add the date to its filename.

While I'm not us­ing such drafts right now, it's look­ing like a nice fea­ture, so I'll think if it could be used for my site.

Other stuff

There are a lot of other things men­tioned in the changelog, but all that mat­ters for me I men­tioned in this post.

Over­all, I'm happy to use Jekyll 1.0 now and rec­om­mend it to any­one —it be­come a bit eas­ier to use with all the new stuff.