2 require "addressable/uri"
4 def opengraph_tags(title = nil, og_image = nil)
6 "og:site_name" => t("layouts.project_name.title"),
7 "og:title" => title || t("layouts.project_name.title"),
8 "og:type" => "website",
9 "og:image" => og_image_url(og_image),
10 "og:url" => url_for(:only_path => false),
11 "og:description" => t("layouts.intro_text")
14 safe_join(tags.map do |property, content|
15 tag.meta(:property => property, :content => content)
21 def og_image_url(og_image)
23 return Addressable::URI.join(root_url, og_image).normalize if og_image
24 rescue Addressable::URI::InvalidURIError
25 # return default image
27 image_url("osm_logo_256.png")