Skip to content
This repository has been archived by the owner on Jul 10, 2020. It is now read-only.

Latest commit

 

History

History
46 lines (33 loc) · 1.45 KB

README.md

File metadata and controls

46 lines (33 loc) · 1.45 KB

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.