lib/opengraph_builder.rb
# Call og_content without arguments to specify where it should render
# OpenGraph meta-tag content and call og_content with arguments to send
# content to the placeholder.
#
# E.g.
# <% og_content 'twitter', card: 'content',
#                       title: 'Example title!',
#                       description: 'Example description',
#                       site: '@example',
#                       image: 'https://placehold.it/100',
#                       creator: '@example' %>
#
# To load this content into a layout view, you would then simply call
# <%= og_content %>
#
Call og_content without arguments to specify where it should render
OpenGraph meta-tag content and call og_content with arguments to send
content to the placeholder.



To load this content into a layout view, you would then simply call
<%= og_content %>
Call og_content without arguments to specify where it should render OpenGraph meta - tag content and call og_content with arguments to send content to the placeholder . To load this content into a layout view you would then simply call <% = og_content % >
def og_content(prefix = nil, **options)
      if prefix || options.empty?
        content_for :opengraph_builder
      else
        options.each do |k, v|
          content_for :opengraph_builder,
                      format('<meta property="%<prefix>s:%<k>s" content="%<v>s">',
                             [prefix || 'og', k, v])
        end
      end
    end
def og_content ( prefix = nil , ** options ) if prefix || options . empty? content_for :opengraph_builder else options . each do | k , v | content_for :opengraph_builder , format ( '<meta property="%<prefix>s:%<k>s" content="%<v>s">' , [ prefix || 'og' , k , v ] ) end end end
Call og_content without arguments to specify where it should render
OpenGraph meta-tag content and call og_content with arguments to send
content to the placeholder.
Call og_content without arguments to specify where it should render OpenGraph meta - tag content and call og_content with arguments to send content to the placeholder .
prefix
<not_specific>
options
<not_specific>