work on #364
This commit is contained in:
@@ -153,6 +153,10 @@ class Post < ActiveRecord::Base
|
||||
end
|
||||
|
||||
module ImageMethods
|
||||
def twitter_card_supported?
|
||||
file_size <= 1.megabyte && image_width.to_i >= 280 && image_height.to_ >= 150
|
||||
end
|
||||
|
||||
def has_large?
|
||||
is_image? && image_width.present? && image_width > Danbooru.config.large_image_width
|
||||
end
|
||||
|
||||
@@ -111,6 +111,12 @@
|
||||
<meta property="og:title" content="<%= h @post.presenter.humanized_essential_tag_string %> - <%= Danbooru.config.app_name %>">
|
||||
<meta property="og:description" content="<%= h @post.presenter.humanized_tag_string %>">
|
||||
<meta property="og:image" content="<%= @post.preview_file_url %>">
|
||||
|
||||
<!-- Twitter properties -->
|
||||
<% if @post.twitter_card_supported? %>
|
||||
<meta name="twitter:card" content="photo">
|
||||
<meta name="twitter:image" content="<%= @post.file_url %>">
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= render "posts/partials/common/secondary_links" %>
|
||||
|
||||
Reference in New Issue
Block a user