Module: Nazca::ViewHelpers
- Defined in:
- lib/nazca/view_helpers.rb
Instance Method Summary collapse
- #canonical(href) ⇒ Object
- #description(d) ⇒ Object
- #keywords(k) ⇒ Object
- #meta_tags(site_name, options = {}) ⇒ Object
- #nofollow(nofollow) ⇒ Object
- #noindex ⇒ Object
- #tag!(tags = {}) ⇒ Object
- #title(t) ⇒ Object
Instance Method Details
#canonical(href) ⇒ Object
33 34 35 |
# File 'lib/nazca/view_helpers.rb', line 33 def canonical(href) tag!(:canonical => true) end |
#description(d) ⇒ Object
18 19 20 21 |
# File 'lib/nazca/view_helpers.rb', line 18 def description(d) tag!(:description => normalize(d)) d end |
#keywords(k) ⇒ Object
13 14 15 16 |
# File 'lib/nazca/view_helpers.rb', line 13 def keywords(k) tag!(:keywords => normalize(k)) k end |
#meta_tags(site_name, options = {}) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/nazca/view_helpers.rb', line 38 def (site_name, = {}) result = "" @_nazca_tags ||= {} [:separator] ||= "|" [:reversed] ||= false .merge!(@_nazca_tags) if [:title].to_s.length > 0 # maybe use ActiveSupport and .present? method title = [site_name, [:separator], [:title]] else title = [site_name] end title.reverse! if [:reverse] result << content_tag(:title, title.join(' ').html_safe) result << tag(:meta, :name => :description, :content => [:description]) if [:description] result << tag(:meta, :name => :keywords, :content => [:keywords]) if [:keywords] return result.html_safe end |
#nofollow(nofollow) ⇒ Object
29 30 31 |
# File 'lib/nazca/view_helpers.rb', line 29 def nofollow(nofollow) tag!(:nofollow => true) end |
#noindex ⇒ Object
24 25 26 |
# File 'lib/nazca/view_helpers.rb', line 24 def noindex tag!(:noindex => true) end |
#tag!(tags = {}) ⇒ Object
3 4 5 6 |
# File 'lib/nazca/view_helpers.rb', line 3 def tag!( = {}) @_nazca_tags ||= {} @_nazca_tags.merge!() end |
#title(t) ⇒ Object
8 9 10 11 |
# File 'lib/nazca/view_helpers.rb', line 8 def title(t) tag!(:title => normalize(t)) t end |