One of my 2015 New Year’s resolutions was to finally turn my "I should write about this" notes into actual writing. So here we are! My first ever blog post! One of the things holding me back when it came to creating a blog is picking one of the many available blog frameworks, there’s just too many to choose from! I wanted something that’s easy to use and easy to back-up.
Just this week I ran into JBake completely by accident (we were working with GVM and I just clicked all the links I didn’t know on that page to see what it was about). Before I hadn’t even thought of using a static blog generator but when I started reading about it, it made perfect sense!
-
It’s Java based (and Java is awesome)
-
It generates static HTML (so it gets indexed just fine by any search engine)
-
It can use groovy templates (Groovy is well, groovy)
-
It can generate posts from MD or AsciiDoc (which is convenient since most my notes are in MD format anyway!)
-
It has code highlighting built-in (which is, when you want to blog about code, somewhat of a must)
-
The source of your blog can just be a git repo (so that solves the back-up issue)
Getting JBake to run is very simple:
-
Download JBake
-
unzip it to a location of your choice
-
you add the /bin directory to your path
-
create a directory somewhere and move into it (mkdir blog, cd blog)
-
run jbake (jbake.bat when you’re on Windows) with the --init option to initialize a blog
-
run jbake without any options to generate the static site
Presto! You now have a blog ready to upload in the blog/output directory. By default it uses Freemarker as the template engine but by running init with the groovy ("jbake --init groovy") or thymeleaf ("jbake --init thymeleaf") option you can use Groovy or Thymeleaf templates. I personally prefer the Groovy templates so I went with those.
It also generates sample content (blog posts and an about) in the content directory. You have the option to use markdown, asciidoc or plain HTML. Although I have my notes in markdown I opted for asciidoc since it seems to have more features. You can mix and match if you want but I’m a sucker for consistency.
So, here we are! Now I just have to create a decent theme and customize the blog a bit. All the hard work is done by JBake