Project

metag

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
This library provides ActionView helpers for meta tags generation
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

Metag

This gem provides ActionView helpers to ease the use of meta tags. It also provides helpers ready to use for Open Graph tags and Twitter Cards tags.

Usage

Several helpers are available :

meta_tag

Generic helper. The last argument given (exception made of hashes) will be used as content, while the others will be joined in order to form the property. You can pass separator: ':' as last argument to change the default separator (which is ':').

meta_tag :name, :value
=> "<meta content=\"value\" property=\"name\" />"

meta_tag :name, :of, :my, :property, :value
=> "<meta content=\"value\" property=\"name:of:my:property\" />"

meta_tag :name, :of, :my, :property, :value, separator: '/'
=> "<meta content=\"value\" property=\"name/of/my/property\" />"

Variants

Three others helpers are available: facebook_tag, opengraph_tag, and twitter_tag (they're respectively aliased to fb_tag, og_tag, and tw_tag). They're just sugar for meta_tag with the first argument set as fb, og, and twitter respectively.

Questions, Feedback

Feel free to ping me on Twitter (@ksol).

Contributing

I don't think there's a lot much to do on this, but hey. If you have any idea of improvement, or anything else, you can use the issues. Or you can just fork, fix, then send me a pull request.

Copyright

See MIT.md for further details.