For my first post, I thought I’d document how I built this site.
Middleman is a tool for dynamically building a static website. There are a variety of advantages to building a static website. For me, I wanted a blog a could control without the bother of setting up, maintaining and eventually moving a database. Plus, even with my current webhost nearly free speech it costs a bit more to add a database instance. Mostly, though, it was thinking about the trouble of dealing with a database.
Bootstrap and LESS
Unfortunately, the version of less.rb that’s available doesn’t support LESS version 1.3.3, which is required by the current version of Twitter Bootstrap. Fortunately, someone alreay patched in support for v1.3.3 and submitted a pull request. In order to use this branch, just use this line in your Gemfile: gem “less”, :git=> ‘git://github.com/populr/less.rb.git’, :branch => “v2.2.2-less1.3.3”, submodules: true You need to add
Middleman-blog is an extension for middleman that makes it nice and easy to write and format blog articles using middleman. The documentation is pretty good for getting the basics up and running, but there are a few things you might want to tweak.
You can move the root for the blog by setting the
blog.prefix variable. *
If you choose to use pretty urls with
activate :directory_indexes you may want to move the the source for ‘blog/index.html’ to ‘blog.html’ *
You can do a lot more than the default layout for the blog! In particular, you may want to do something different when rendering a blog article. The following simply adds a level-two header containing the title:
<% if is_blog_article? %> <article> <h2><%= current_article.title %></h2> <%= yield %> </article> <% else %> <%= yield %> <% end %>