Socket
Book a DemoInstallSign in
Socket

html_meta

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html_meta

0.0.1
bundlerRubygems
Version published
Maintainers
1
Created
Source

HtmlMeta (beta)

Helps with constructing meta tags

Installation

Add this line to your application's Gemfile:

gem 'html_meta'

And then execute:

$ bundle

Or install it yourself as:

$ gem install html_meta

Usage

In an initializer file set any configuration options:

HtmlMeta.configure do |config|	
	config.title_separator = ' | '
end

Set some defaults in an initializer file:

HtmlMeta.define do
	meta :title, '21purple Web Studios'
	meta :keywords, 'expressionengine developer development php custom web application'
	meta :description, 'We are an awesome web development shop'
end

And then later in a controller action or where ever modify the meta tag values:

HtmlMeta.define do
	meta :title, 'Ruby Development', prepend: true
	meta :keywords, 'ruby rails padrino', append: true
	meta :description, 'We are an awesome ruby web development shop'
	open_graph :title, 'Ruby Developer'
end

You can also use the shorthand method og for setting open graph tags:

HtmlMeta.define do
	og :title, 'Ruby Developer'
end

You can also set a single meta tag value:

HtmlMeta.meta :title, 'Rails Development', prepend: true

Or you can get a meta tag value:

HtmlMeta.meta :title

The open graph tags have similar setters:

HtmlMeta.open_graph :title, 'Rails Development', prepend: true

or 

HtmlMeta.og :title, 'Rails Development', prepend: true

And getters:

HtmlMeta.open_graph :title

or 

HtmlMeta.og :title

And then render the html for the meta tags:

HtmlMeta.render

Contributing

  • Fork it
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Added some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create new Pull Request

FAQs

Package last updated on 06 Oct 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.