How to get a hacker to blog…
I enjoy hacking, not blogging. Over the years I have attempted to blog, each time losing interest in favour of some hacking. But times are a changing, and what better way for a hacker to blog, but to blog about his blog related hacking.
Lets begin – Hacking the Blog
fun simple blogging
something somewhat homebrew.
After using Webby for various projects I decided that it was about time to use it for myself. I also did not have a blog so I decided to combine them and now I have a Webby power blog. If your wondering how this is was done feel free to view, modify or play with the source of this webb blog over at Github.
Webby is a tiny static file based website management system written in ruby.
- No Magic — No magic, if something goes wrong or if you want to change something no complicated code base sits in your way.
- Static — Any webhost will do, no scripting languages or databases are required for the host. Why waste valuable resources on a site that will remain static 99% of the time?
- Templates — Using Haml , Textile , and Markdown , or other templating languages instead of pure html is pure awesome sauce. Unfortunately browsers still like there html and cannot interpret these templating languages directly. This is not a problem for larger web application frameworks such as Merb or Ruby on Rails. since they already take advantage of various templating and markup languages. But for simple sites the overhead of a full application stack is pointless. Luckily Webby comes to the rescue and allows us to use these templating languages on static sites.
Code duplication sucks, and again this is something larger frameworks help prevent with various templating tricks. Webby brings many of these tricks back to static websites. Here are two core features of the blog gistified:
# Webby provides us with the @pages instance variable, # which is a ruby enumerable of all the pages webby indexes. # The snippet below gives me access to all my blog posts. posts = @pages.find(:all, in_directory: 'blog', recursive: true, sort_by: 'created_at', reverse: true)
# Now we can easily perform some ruby magic to group the # posts by months. posts.group_by do |post| post.created_at.strftime('%B %Y') end.each do |group,posts| # ... end
No regrets using webby to hack together this little blog, but I would like to point out that such a blog is not for everyone. If you are more confortable with a wysiwyg style editor this is probabily not your cup of tea and I would suggest you look into something like Wordpress .