No commit activity in last 3 years
No release in over 3 years
A middleman extension inspired by the metatag gem that helps manage metatags.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7
~> 10.0

Runtime

 Project Readme

Middleman::Autometatags

This is a middleman extension that helps manage metatags. It will make guesses pages on the page metadata and data/site.yml to set things correctly.

SEO gem for your Middleman apps.

Based on meta-tags Rails gem and the middleman-meta-tags middleman extension.

Installation

Add this line to your middleman's Gemfile:

gem 'middleman-autometatags'

Usage

Configuration

Edit config.rb and add:

activate :autometatags

Create data/site.yml

This will look inside of data/site.yml file to find any site wide defaults.

For example

title: "Will Schenk"
twitter_author: "@wschenk"

Title

set_meta_tags title: 'Relevant title'
title 'Relevant title'

Description

set_meta_tags description: 'Powerful website full of best practices and keywords'
description 'Powerful website full of best practices and keywords'

Keywords

set_meta_tags keywords: %w(some seo keywords).join(', ')
keywords %w(some seo keywords).join(', ')

Display meta tags

Into your <head></head> tag:

auto_display_meta_tags

By default, there is a | as separator between title and website name.

You can modify it by adding: separator: '&raquo;'

Autotagging

This will look inside of data/site.yml file to find any site wide defaults. Then it looks the page meta data to attempt to display the following keys:

  • MM title => META site
  • MM description => META description
  • MM title => og:site_name
  • MM twitter_card (defaults to summary_large_image) => META twitter:card
  • MM title => META twitter:title
  • MM publisher_twitter => META twitter:site
  • MM twitter_author => META twitter:creator
  • MM description => META twitter:description
  • MM pull_image => META twitter:image:src
  • MM title => META og:title
  • MM description => META og:description
  • MM pull_image => META og:image

Manually adding addition tags

Create a helper method inside of your config.rb, like so

helper do
  def my_tags
    set_meta_tags key => value
  end
end

And add it to the layouts and views that you need.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request