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
33
34
35
36
37
38
39
40
41
|
# File 'lib/seorel/helper/open_graph.rb', line 33
def all
([
title_tag,
description_tag,
locale_tag,
image_tag,
url_tag
] + custom_tags).compact
end
|
27
28
29
30
31
|
# File 'lib/seorel/helper/open_graph.rb', line 27
def custom_tags
params..reduce([]) do |data, (key, value)|
data.push custum_tag(key, value)
end
end
|
#description_tag ⇒ Object
11
12
13
|
# File 'lib/seorel/helper/open_graph.rb', line 11
def description_tag
h.content_tag :meta, nil, property: 'og:description', content: description
end
|
#image_tag ⇒ Object
19
20
21
|
# File 'lib/seorel/helper/open_graph.rb', line 19
def image_tag
h.content_tag(:meta, nil, property: 'og:image', content: image_url) if image
end
|
#locale_tag ⇒ Object
15
16
17
|
# File 'lib/seorel/helper/open_graph.rb', line 15
def locale_tag
h.content_tag(:meta, nil, property: 'og:locale', content: locale)
end
|
#title_tag ⇒ Object
7
8
9
|
# File 'lib/seorel/helper/open_graph.rb', line 7
def title_tag
h.content_tag :meta, nil, property: 'og:title', content: title
end
|
#url_tag ⇒ Object
23
24
25
|
# File 'lib/seorel/helper/open_graph.rb', line 23
def url_tag
h.content_tag(:meta, nil, property: 'og:url', content: request.url)
end
|