middleman-meta-tags is an extension for the Middleman static site generator that adds easy meta tags in a similar opinionated way as
Dmytro Shteflyuk's excellent meta-tags for Rails.
This is a work-in-progress. I wanted to familiarize myself with Cucumber for testing and also extending a library like Middleman. Also, meta-tags is a great convenience for Rails and it'd be nice to have it for other frameworks too!
If you're just getting started, install the middleman gem and generate a new project:
gem install middleman
middleman init MY_PROJECTIf you already have a Middleman project: Add gem "middleman-meta-tags" to your Gemfile and run bundle install.
activate :meta_tagsThe extension adds new helpers for your templates.
In your my_layout.erb, you might do something like this:
<head>
<%= display_meta_tags site: 'Hello world!', description: 'This is the descriptive field' %>
</head>
...Which will render this:
<head>
<title>Hello world!</title>
<meta name="description" content="This is the descriptive field" />
</head>
... In a page wrapped by my_layout.erb, you can override the site-wide tags using the title helper like so:
---
title: This is my title
---
<h1><%=title current_page.data.title %></h1><html>
<head>
<title>This is my title</title>
<meta name="description" content="This is the descriptive field" />
</head>
<body>
<h1>This is my title</h1>
</body>
</html> - Checkout Repository:
git clone https://github.com/middleman/middleman-meta-tags.git - Install Bundler:
gem install bundler - Run
bundle installinside the project root to install the gem dependencies. - Run test cases:
bundle exec rake test
Click here to lend your support to Middleman
Copyright (c) 2013-2014 Dan Nguyen. MIT Licensed