]> git.openstreetmap.org Git - rails.git/blob - app/helpers/open_graph_helper.rb
Bump actions/checkout from 2.3.5 to 2.4.0
[rails.git] / app / helpers / open_graph_helper.rb
1 module OpenGraphHelper
2   def opengraph_tags(title = 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" => image_url("osm_logo_256.png", :protocol => "http"),
8       "og:image:secure_url" => image_url("osm_logo_256.png", :protocol => "https"),
9       "og:url" => url_for(:only_path => false),
10       "og:description" => t("layouts.intro_text")
11     }
12
13     safe_join(tags.map do |property, content|
14       tag.meta(:property => property, :content => content)
15     end, "\n")
16   end
17 end