]> git.openstreetmap.org Git - rails.git/blob - app/helpers/open_graph_helper.rb
Merge remote-tracking branch 'upstream/pull/4882'
[rails.git] / app / helpers / open_graph_helper.rb
1 module OpenGraphHelper
2   def opengraph_tags(title = nil, og_image = nil)
3     tags = {
4       "og:site_name" => t("layouts.project_name.title"),
5       "og:title" => [title, t("layouts.project_name.title")].compact.join(" | "),
6       "og:type" => "website",
7       "og:image" => og_image ? URI.join(root_url, og_image) : image_url("osm_logo_256.png"),
8       "og:url" => url_for(:only_path => false),
9       "og:description" => t("layouts.intro_text")
10     }
11
12     safe_join(tags.map do |property, content|
13       tag.meta(:property => property, :content => content)
14     end, "\n")
15   end
16 end