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



3
4
5
# File 'app/helpers/pages_core/open_graph_tags_helper.rb', line 3

def open_graph_properties
  @open_graph_properties ||= {}
end

#open_graph_tagsObject

Outputs Open Graph tags for Facebook.



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

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