Class: Seorel::Helper::OpenGraph
- Inherits:
-
Base
- Object
- Base
- Seorel::Helper::OpenGraph
show all
- Defined in:
- lib/seorel/helper/open_graph.rb
Instance Attribute Summary
Attributes inherited from Base
#params, #request
Instance Method Summary
collapse
Methods inherited from Base
#helpers, #image_url, #initialize, #locale, #render
Instance Method Details
#all ⇒ Object
35
36
37
38
39
40
41
42
43
|
# File 'lib/seorel/helper/open_graph.rb', line 35
def all
([
title_tag,
description_tag,
locale_tag,
image_tag,
url_tag
] + custom_tags).compact
end
|
29
30
31
32
33
|
# File 'lib/seorel/helper/open_graph.rb', line 29
def custom_tags
params..reduce([]) do |data, (key, value)|
data.push custum_tag(key, value)
end
end
|
#description_tag ⇒ Object
13
14
15
|
# File 'lib/seorel/helper/open_graph.rb', line 13
def description_tag
h.tag :meta, property: 'og:description', content: description
end
|
#image_tag ⇒ Object
21
22
23
|
# File 'lib/seorel/helper/open_graph.rb', line 21
def image_tag
h.tag(:meta, property: 'og:image', content: image_url) if image
end
|
#locale_tag ⇒ Object
17
18
19
|
# File 'lib/seorel/helper/open_graph.rb', line 17
def locale_tag
h.tag(:meta, property: 'og:locale', content: locale)
end
|
#title_tag ⇒ Object
9
10
11
|
# File 'lib/seorel/helper/open_graph.rb', line 9
def title_tag
h.tag :meta, property: 'og:title', content: title
end
|
#url_tag ⇒ Object
25
26
27
|
# File 'lib/seorel/helper/open_graph.rb', line 25
def url_tag
h.tag(:meta, property: 'og:url', content: request.url)
end
|