Module: ViewFu::MetaHelper

Defined in:
lib/view_fu/meta_helper.rb

Instance Method Summary collapse

Instance Method Details

#meta_description(meta_description = nil) ⇒ Object

Get/Set Meta Description



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/view_fu/meta_helper.rb', line 32

def meta_description(meta_description = nil)
  if meta_description
    @__meta_description = meta_description
  else
    @__meta_description ||= ""
  
    # Check if we have AppConfig to use for default
    if defined? AppConfig
      default_meta_description = AppConfig.default_meta_description 
    else
      default_meta_description = ""
    end
  
    # set the default if meta_description is blank
    @__meta_description = default_meta_description if @__meta_description.blank?
  end
  return @__meta_description
end

#meta_keywords(meta_keywords = nil) ⇒ Object

Get/Set Meta Keywords



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/view_fu/meta_helper.rb', line 12

def meta_keywords(meta_keywords = nil)
  if meta_keywords
    @__meta_keywords = meta_keywords
  else
    @__meta_keywords ||= ""
  
    # Check if we have AppConfig to use for default
    if defined? AppConfig
      default_meta_keywords = AppConfig.default_meta_keywords
    else
      default_meta_keywords = ""
    end
  
    # set the default if meta_keywords is blank
    @__meta_keywords = default_meta_keywords if @__meta_keywords.blank?
  end
  return @__meta_keywords
end

#meta_tagsObject

Output the current page’s meta tags



4
5
6
7
8
9
# File 'lib/view_fu/meta_helper.rb', line 4

def meta_tags
  %(
    <meta name="keywords" content="#{meta_keywords}" />
    <meta name="description" content="#{meta_description}" />
  )
end