1module SocialMetaHelper |
|
|
2 def open_graph_tag(name, content, interpolation = {}) |
3 if Symbol === content |
|
4 tag(:meta, property: "og:#{name}", content: t(content, interpolation.merge(scope: :'metadata.open_graph'))) |
|
5 elsif name == 'image' |
|
6 tag(:meta, property: "og:image", content: url_to_image(content)) |
|
7 else |
|
8 tag(:meta, property: "og:#{name}", content: content) |
|
9 end |
|
10 end |
|
|
12 def twitter_card_tag(name, content, interpolation = {}) |
13 if Symbol === content |
|
14 tag(:meta, name: "twitter:#{name}", content: t(content, interpolation.merge(scope: :'metadata.twitter'))) |
|
15 elsif name == 'image' |
|
16 tag(:meta, name: "twitter:image", content: url_to_image(content)) |
|
17 else |
|
18 tag(:meta, name: "twitter:#{name}", content: content) |
|
19 end |
|
20 end |
|
21end |