Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. module SocialShareHelper
  2. def social_share_attributions(twitter_card = 'summary_large_image', og_type = 'website')
  3. tag_builder 'twitter:site', global_site_settings['Twitter'] if global_site_settings['Twitter'].present?
  4. tag_builder 'twitter:card', twitter_card
  5. tag_builder 'og:site_name', global_site_settings['Name']
  6. tag_builder 'og:url', request.original_url
  7. tag_builder 'og:type', og_type
  8. tag_builder 'og:locale', 'en_GB'
  9. end
  10.  
  11. def og_title(content)
  12. social_share_attributions
  13. tag_builder 'og:title', content
  14. tag_builder 'twitter:title', content
  15. end
  16.  
  17. def og_description(content)
  18. tag_builder 'og:description', content
  19. tag_builder 'twitter:description', content
  20. end
  21.  
  22. def og_image(content)
  23. tag_builder 'og:image', content
  24. tag_builder 'twitter:image', content
  25. end
  26.  
  27. def twitter_creator(content)
  28. tag_builder 'twitter:creator', content
  29. end
  30.  
  31. def tag_builder(property, content)
  32. content_for :head do
  33. concat "\n "
  34. concat tag :meta, property: property, content: content
  35. end
  36. end
  37. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement