Skip to content

Recent Articles

Jun
30
2012

Blogging With Jekyll

Posted on June 30, 2012 in Administrivia

I have to say I'm finding it very easy to add functionality to the blog now that I've switched to jekyll. Jekyll generates static pages to implement your website rather than requiring a server-side database and code written in ruby, PHP or what have you. Since the web server doesn't have to run any code to generate your pages, it just serves up pre-built static files, its faster and puts less of a load on your server. The server load is a big deal when working with shared hosts. If all the shared accounts were serving up static pages, it would be much faster than running all that PHP or Ruby on Rails or Django code.

This means that all of the dynamic capability of your web site has to be implemented in client-side javascript that will run in the browser. For example, the headers over in the sidebar such as "Recent Articles" or "Categories" toggle between showing their contents and hiding them when you click on the heading. This is all done with client-side javascript as you would expect with data built into the site when it is statically generated. There are no AJAX requests going on behind the scenes requesting the contents from the server on the fly.

Of course, you could still write some server-side code if you want and provide dynamic functionality. But I'm trying to avoid that as much as possible. Everything is static HTML, CSS and Javascript. Actually, its not, but I'll get to that later. And its just as easy to incorporate javascript widgets like the Twitter widget in the sidebar as it is in "regular" old-style sites.

But because everything is statically generated, I can code the site, generate it and run it locally on my Macbook Pro to debug it. This process is so much faster than messing with Wordpress templates that I find myself constantly tweaking and changing things now. At one point in the past, I had set up a local instance of Wordpress, MySQL, PHP and Apache just to test drive things locally. But this is still faster and more enjoyable. I think its because I'm a developer. The process of editing the site, generating the site, debugging it locally and then deploying to the actual server is so much like the software development process... no, it is the software development process that we're all used to. This system works the way I think.

And, of course, the entire site source is committed to a git repo, so I can work on the site in an offline manner while still using all the same best practices for software development. The files themselves, as I mentioned before, aren't just HTML, CSS and Javascript. That's for the site template, the look and feel and dynamic behavior that is common to every page. But the content itself: the posts, the sidebar items and any one-off, non-post pages are written in markdown and get converted to HTML while being mixed into the HTML, CSS and Javascript code during the site generation process.

The site generation process is just like a software build process. There's a Rakefile (jekyll is a ruby gem) that has targets to generate the site, stand it up in a temporary local server for debugging, and even to automatically deploy it to your real server via ssh & rsync. Now some of that you have to build into the Rakefile yourself, such as the deployment target. But that's just another way you can automate the build system just like any other software development project.

All in all, I'm very satisfied with the jekyll experience. I think it will remove barriers to the frequency of my posting. And it will certainly cause me to continually tinker with the site. In fact, the site may never settle down into a stable, unchanging, "finished" state. And why should it?


Tagged in jekyll,, blogging,, "web, development"
« Previous Post: Furlongs Per Fortnight | Next Post:  »
blog comments powered by Disqus