Juicy lil' bytes

How to Set Your Octopress Site Description and Keyword Meta Tags

Here is the missing documentation on how to set up description and keyword meta tags for your home page and all posts on your Octopress site.

Main Page Changes

Open the _config.yml file in an editor and enter a site description in the description field. Then add a new keywords field and enter your comma delimited keyword list:

Example Configuration of _config.yml
1
2
3
4
5
6
7
8
9
10
11
# ----------------------- #
#      Main Configs       #
# ----------------------- #

url: http://sweetme.at
title: Sweetmeat
subtitle: Juicy lil' bytes
author: Chris Simpkins
simple_search:
description: A really catchy description here.
keywords: key 1, key 2, key 3, key 4, key 5

Post Changes

For any existing posts or any new posts that you create with the rake new_post['title'] command, you will need to add description and keyword fields to the YAML frontmatter in the post markdown file before you generate the html pages with the rake generate command. Octopress does not generate these fields by default. Here is how the YAML frontmatter should appear in your post:

YAML frontmatter with description and keywords meta fields
1
2
3
4
5
6
7
8
9
---
layout: post
title: "How to Set Your Octopress Site Description and Keyword Meta Tags"
date: 2013-08-06 23:18
comments: true
categories:
description: Don't know how to set your Octopress description and keyword meta tags? Here is the solution.
keywords: octopress, blog, meta, description, keyword, how to, guide, help
---

Make the Magic Happen

In order to properly display your home page description and keyword meta tags, you need to modify the source/_includes/head.html file with the following changes so that the keyword and description tags are appropriately generated on the home page and in your post pages when you create your html files.

The default section of the head.html file contains a code block that looks like this:

Change this to the following script:

These modifications will correctly update the home page with your site wide keyword and description meta tags, and your post pages with the information that you added in the YAML frontmatter for each post.

Generate Your Static Site Files

Now, simply re-generate your static html pages with the following command in the top level directory for your site:

Generate Your Static HTML files
1
rake generate

and then deploy your site with whatever approach you are using (git, rsync, etc.).