Module: PagesCore::OpenGraphTagsHelper

Included in:
ApplicationHelper
Defined in:
app/helpers/pages_core/open_graph_tags_helper.rb

Instance Method Summary collapse

Instance Method Details

#open_graph_propertiesObject



5
6
7
# File 'app/helpers/pages_core/open_graph_tags_helper.rb', line 5

def open_graph_properties
  @open_graph_properties ||= {}
end

#open_graph_tagsObject

Outputs Open Graph tags for Facebook.



10
11
12
13
14
15
16
17
18
19
20
# File 'app/helpers/pages_core/open_graph_tags_helper.rb', line 10

def open_graph_tags
  properties = default_open_graph_properties.merge(open_graph_properties)
  safe_join(
    properties
      .delete_if { |_, content| content.nil? }
      .map do |name, content|
      tag.meta(property: "og:#{name}", content: content)
    end,
    "\n"
  )
end