Add non blog pages to a middleman blog

Nov 18 2017

Having set middleman up to be a static blog, you might find yourself wanting to add some static pages outside of the blog structure. For example, if you install any analytics on your site, you often need to include a static file with an authentication code to your analytics provider. These pages are often barebones, with no common header or footer and no styling and you almost certainly do not need them to be processed from markdown. In other words, you want to create a page that does not use the layouts that the rest of your site uses.

To set these up, create the html page and then edit your config.rb to include something like the following:

page "my_barebones_page.html", directory_index: false, layout:false

Using layout: false is reasonably self-explanatory; you are instructing middleman to forego any layout for this page. The inclusion of directory_index: false makes sure that the page is accessible with the .html suffix. This is especially useful if you are using pretty urls for your blog.