Sha256: f3a08c66817c759c5e76dbe465fc298a88dfd22c37ef236b6573a12bc727afc7
Contents?: true
Size: 1.19 KB
Versions: 1
Compression:
Stored size: 1.19 KB
Contents
# encoding: utf-8 module PagesCore module OpenGraphTagsHelper def open_graph_properties @_open_graph_properties ||= {} end # Outputs Open Graph tags for Facebook. 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 private def default_open_graph_title if @page.try(:open_graph_title?) @page.open_graph_title else document_title end end def default_open_graph_description if @page.try(:open_graph_description?) @page.open_graph_description elsif meta_description? meta_description end end def default_open_graph_properties { type: "website", site_name: PagesCore.config(:site_name), title: default_open_graph_title, image: (meta_image if meta_image?), description: default_open_graph_description, url: request.url } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pages_core-3.5.1 | app/helpers/pages_core/open_graph_tags_helper.rb |