Middleman is a neat Ruby-based static site generator that provides a good alternative to Jekyll if you want something simpler and not focused on blogging. As such, we're using it for our new company site.
We ran into an annoying bug with it, however.
We're using Netlify to host the new, Middleman-built site and Netlify lets you use a
_redirects file to specify all of the redirected URLs you want on your site. Great, except that if you place a
_redirects file in your Middleman site, it doesn't get copied across into the final build of the site!
It turns out the reason for this is that Middleman treats files beginning with an underscore as special (since they could be partials) and you need to manually specify the inclusion of such static files in the build.
Add this to
import_file File.expand_path("_redirects", config[:source]), "/_redirects"
import_file manually brings a file from one location to another in your final build, so this brings the
_redirects file in the site's 'source' directory to live at
/_redirects in the final site and Netlify is happy!