@opengraph_properties = {
"og:image" => @entry.body.image,
"og:image:alt" => @entry.body.image_alt,
- "og:description" => @entry.body.description
+ "og:description" => @entry.body.description,
+ "article:published_time" => @entry.created_at.xmlschema
}
@comments = can?(:unhide, DiaryComment) ? @entry.comments : @entry.visible_comments
else
"og:description" => properties["og:description"] || t("layouts.intro_text")
}.merge(
opengraph_image_properties(properties)
+ ).merge(
+ properties.slice("article:published_time")
)
safe_join(tags.map do |property, content|
end
end
+ def test_show_article_published_time
+ user = create(:user)
+ diary_entry = create(:diary_entry, :user => user, :created_at => "2020-03-04")
+
+ get diary_entry_path(user, diary_entry)
+ assert_response :success
+ assert_dom "head meta[property='article:published_time']" do
+ assert_dom "> @content", "2020-03-04T00:00:00Z"
+ end
+ end
+
def test_hide
user = create(:user)
diary_entry = create(:diary_entry, :user => user)