Sha256: 4cd3a1305a3f82651d3f1c7c9ea78126a508a4ec264ec3405fe4d6971fcc1fe8
Contents?: true
Size: 1.52 KB
Versions: 1
Compression:
Stored size: 1.52 KB
Contents
module TopHat module MetaHelpers def meta_tag(options) # tag :meta, :name => options[:name], :content => options[:content] "<meta name=\"#{options[:name]}\" content=\"#{options[:content]}\" />" end # page descriptions # <meta name="description" content="Description goes here." /> def description(options=nil) if options.is_a? String @tophat_description = options else options ||= {} options.merge!(:name => 'description') if @tophat_description.blank? options.merge!(:content => options.delete(:default)) else options.merge!(:content => @tophat_description) end meta_tag(options) if options[:content] end end # keywords # <meta name="keywords" content="Keywords go here." /> def keywords(options=nil) if options.is_a?(String) @tophat_keywords = options elsif options.is_a?(Array) @tophat_keywods = options.join(', ') else options ||= {} options.merge!(:name => 'keywords') if @tophat_keywords.blank? keywords = options.delete(:default) if keywords && keywords.is_a?(Array) keywords = keywords.join(', ') end options.merge!(:content => keywords) else options.merge!(:content => @tophat_keywords) end meta_tag(options) if options[:content] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tophat-1.0.0 | lib/tophat/meta.rb |