Sha256: 662c447e07d15b75bb1bfee2a7cdb1f68e0b0a9434c1fd84718d103ec9aed576
Contents?: true
Size: 1.62 KB
Versions: 1
Compression:
Stored size: 1.62 KB
Contents
module TopHat module MetaHelper # 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 tag(:meta, 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') default_keywords = options.delete(:default) || [] display_keywords = @tophat_keywords.blank? ? default_keywords : @tophat_keywords # normalize the keywords default_keywords = default_keywords.is_a?(String) ? default_keywords.split(', ') : default_keywords display_keywords = display_keywords.is_a?(String) ? display_keywords.split(', ') : display_keywords # merge keyword arrays if merge is set to true display_keywords += default_keywords if options.delete(:merge_default) == true options.merge!(:content => display_keywords.uniq.join(', ')) tag(:meta, options) if display_keywords.any? end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tophat-1.2.0 | lib/tophat/meta.rb |