if @entry
@title = t ".title", :user => params[:display_name], :title => @entry.title
@opengraph_properties = {
+ "og:title" => @entry.title,
"og:image" => @entry.body.image,
"og:image:alt" => @entry.body.image_alt,
"og:description" => @entry.body.description,
def opengraph_tags(title, properties)
tags = {
"og:site_name" => t("layouts.project_name.title"),
- "og:title" => title || t("layouts.project_name.title"),
+ "og:title" => properties["og:title"] || title || t("layouts.project_name.title"),
"og:type" => "website",
"og:url" => url_for(:only_path => false),
"og:description" => properties["og:description"] || t("layouts.intro_text")
end
end
+ def test_show_og_title
+ user = create(:user)
+ diary_entry = create(:diary_entry, :user => user, :title => "The Important Blog Post")
+
+ get diary_entry_path(user, diary_entry)
+ assert_response :success
+ assert_dom "head meta[property='og:title']" do
+ assert_dom "> @content", "The Important Blog Post"
+ end
+ end
+
def test_show_og_image_with_no_image
user = create(:user)
diary_entry = create(:diary_entry, :user => user, :body => "nothing")