Class: Seorel::Helper::Twitter

Inherits:
Base
  • Object
show all
Defined in:
lib/seorel/helper/twitter.rb

Instance Attribute Summary

Attributes inherited from Base

#params, #request

Instance Method Summary collapse

Methods inherited from Base

#helpers, #image_url, #initialize, #locale, #render

Constructor Details

This class inherits a constructor from Seorel::Helper::Base

Instance Method Details

#allObject



31
32
33
34
35
36
37
38
# File 'lib/seorel/helper/twitter.rb', line 31

def all
  ([
    title_tag,
    description_tag,
    image_tag,
    url_tag
  ] + custom_tags).compact
end

#custom_tagsObject



25
26
27
28
29
# File 'lib/seorel/helper/twitter.rb', line 25

def custom_tags
  params.twitter_extras.reduce([]) do |data, (key, value)|
    data.push custum_tag(key, value)
  end
end

#description_tagObject



13
14
15
# File 'lib/seorel/helper/twitter.rb', line 13

def description_tag
  h.tag :meta, name: 'twitter:description', content: description
end

#image_tagObject



17
18
19
# File 'lib/seorel/helper/twitter.rb', line 17

def image_tag
  h.tag(:meta, name: 'twitter:image', content: image_url) if image
end

#title_tagObject



9
10
11
# File 'lib/seorel/helper/twitter.rb', line 9

def title_tag
  h.tag :meta, name: 'twitter:title', content: title
end

#url_tagObject



21
22
23
# File 'lib/seorel/helper/twitter.rb', line 21

def url_tag
  h.tag(:meta, name: 'twitter:url', content: request.url)
end