Module: FacebookSocialPlugins::Helper::OpenGraph
- Defined in:
- lib/facebook-social_plugins/helper/open_graph.rb
Instance Method Summary collapse
- #fb_app_id(app_id) ⇒ Object
- #og_desc(desc) ⇒ Object
- #og_header(name, namespace, &block) ⇒ Object
- #og_image(href) ⇒ Object
- #og_title(title) ⇒ Object
- #og_type(namespace, object_type) ⇒ Object
- #og_url(href) ⇒ Object
- #open_graph_meta(name, namespace, app_id, object_type, options = {}) ⇒ Object
Instance Method Details
#fb_app_id(app_id) ⇒ Object
8 9 10 |
# File 'lib/facebook-social_plugins/helper/open_graph.rb', line 8 def fb_app_id app_id content_tag :meta, '', :property => "fb:app_id", :content => app_id end |
#og_desc(desc) ⇒ Object
24 25 26 |
# File 'lib/facebook-social_plugins/helper/open_graph.rb', line 24 def og_desc desc content_tag :meta, '', :property => "og:description", :content => desc end |
#og_header(name, namespace, &block) ⇒ Object
3 4 5 6 |
# File 'lib/facebook-social_plugins/helper/open_graph.rb', line 3 def og_header name, namespace, &block content = capture(&block) content_tag :head, content, :prefix => "og: http://ogp.me/ns# og_#{name}: http://ogp.me/ns/apps/#{namespace}x#" end |
#og_image(href) ⇒ Object
20 21 22 |
# File 'lib/facebook-social_plugins/helper/open_graph.rb', line 20 def og_image href content_tag :meta, '', :property => "og:image", :content => href end |
#og_title(title) ⇒ Object
16 17 18 |
# File 'lib/facebook-social_plugins/helper/open_graph.rb', line 16 def og_title title content_tag :meta, '', :property => "og:title", :content => title end |
#og_type(namespace, object_type) ⇒ Object
12 13 14 |
# File 'lib/facebook-social_plugins/helper/open_graph.rb', line 12 def og_type namespace, object_type content_tag :meta, '', :property => "og:type", :content => "#{namespace}:#{object_type}" end |
#og_url(href) ⇒ Object
28 29 30 |
# File 'lib/facebook-social_plugins/helper/open_graph.rb', line 28 def og_url href content_tag :meta, '', :property => "og:url", :content => href end |
#open_graph_meta(name, namespace, app_id, object_type, options = {}) ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/facebook-social_plugins/helper/open_graph.rb', line 32 def name, namespace, app_id, object_type, = {} content = fb_app_id(app_id) + og_type(namespace, object_type) content << og_title([:title]) if [:title] content << og_image([:img]) if [:img] content << og_image([:desc]) if [:desc] content << og_image([:url]) if [:url] og_header(name, namespace) do content end end |