Jekyll is a blogging platform, actually you are seeing it in action right now. This whole site is build on top of jekyll.
Jekyll uses partials and layouts like Rails does, but its especially good with blog posts.
It supports sass and liquid so you can make and style pages with ease.
Jekyll compiles all your web-logic to a folder named
_site from there it is a static site.
Ready to be deployed anywhere.
GitHub pages supports Jekyll that means you can easily upload your Jekyll site to a repository and GitHub will host it for you.
However Jekyll lacks some functionality, since it compiles to a static website, you can not use Ruby for controllers, routers and models. And that poses a problem if you want some dynamic functionality in your website.
Rake is a Make implementation in Ruby. What it actually is, is a tasks manager, you tell Rake what you want to do and how, and it will do it for you, whenever you ask. That can be extremely usefull when you want to automate certain tasks for your webapp (or any tasks that is).
If you have used Rails or some other Ruby framework chances are you already encountered
rake db:migrate bring any memories? In fact even
rails generate uses rake.
Rake knows how to use shell commands and (ofcourse) understands Ruby.
Like Rubygems Rake uses a file name
Rakefile. Inside the
Rakefile you write your
tasks, and then you “command” Rake to execute those tasks through your Terminal.
Now lets see what we can do with these two.
Semi-Dynamic content with Jekyll and Rake
To give you an idea of how you can build semi dynamic content in Jekyll I’ll walk you through some code I found when I wanted to implement tags to this website. The code was written by Leon Bradley so I claim no copywrite.
Since we want out end result to be static
First lets see the ‘snippet’ of code that generates tags based on my posts.