How To Add Meta Descriptions to Middleman Pages

The ability to tweak meta descriptions and titles to improve click-through rates is a key part of SEO. <!-- more --> Fortunately, it takes about 30 seconds to add meta descriptions and titles in the Middleman static site generator.

Add the following to <code>layout.erb</code> between the head tags:

<meta content="<%= || %>" name="description" />

Then specify a description in the YAML frontmatter. Remember that the upper limit for meta descriptions is 160 characters.

title: On the Origin of Species
date: '1859-11-24 00:00:00'
- evolution
description: The scientific theory that     
populations evolve over the course of     
generations through a process of    
natural selection.

You can confirm that the meta description is working by viewing the source.