Skip to content

Commit

Permalink
Add more detail to OpenGraph tags
Browse files Browse the repository at this point in the history
Closes #1073
  • Loading branch information
tomhughes committed Oct 26, 2015
1 parent 447fef4 commit e62e879
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions app/helpers/open_graph_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module OpenGraphHelper
def opengraph_tags(title = nil)
tags = {
"og:site_name" => t("layouts.project_name.title"),
"og:title" => [t("layouts.project_name.title"), title].compact.join(" | "),
"og:type" => "website",
"og:image" => image_path("osm_logo.svg", :host => SERVER_URL),
"og:image:width" => "200",
"og:image:height" => "200"
}

tags.map do |property, content|
tag(:meta, :property => property, :content => content)
end.join("").html_safe
end
end
2 changes: 1 addition & 1 deletion app/views/layouts/_head.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<%= tag("link", { :rel => "publisher", :href => "https://plus.google.com/111953119785824514010" }) %>
<%= tag("link", { :rel => "search", :type => "application/opensearchdescription+xml", :title => "OpenStreetMap Search", :href => asset_path("osm.xml") }) %>
<%= tag("meta", { :name => "description", :content => "OpenStreetMap is the free wiki world map." }) %>
<%= tag("meta", :property => "og:image", :content => image_path("osm_logo.png")) %>
<%= opengraph_tags %>
<% if flash[:piwik_goal] -%>
<%= tag("meta", :name => "piwik-goal", :content => flash[:piwik_goal]) %>
<% end -%>
Expand Down

0 comments on commit e62e879

Please sign in to comment.