fixes #2465: Switch Twitter cards to use summary card+image
This commit is contained in:
@@ -384,3 +384,6 @@ DEPENDENCIES
|
|||||||
vcr
|
vcr
|
||||||
webmock
|
webmock
|
||||||
whenever
|
whenever
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
1.10.0
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ class Post < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def twitter_card_supported?
|
def twitter_card_supported?
|
||||||
image_width.to_i >= 280 && image_height.to_i >= 150
|
image_width.to_i >= 280 && image_height.to_i >= 150 && file_size <= 1.megabyte
|
||||||
end
|
end
|
||||||
|
|
||||||
def has_large?
|
def has_large?
|
||||||
|
|||||||
@@ -163,10 +163,11 @@
|
|||||||
|
|
||||||
<!-- Twitter properties -->
|
<!-- Twitter properties -->
|
||||||
<% if @post.twitter_card_supported? %>
|
<% if @post.twitter_card_supported? %>
|
||||||
<meta name="twitter:card" content="photo">
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
<meta name="twitter:image:src" content="http://<%= Danbooru.config.hostname %><%= @post.large_file_url %>">
|
<meta name="twitter:site" content="<%= Danbooru.config.twitter_site %>">
|
||||||
<meta name="twitter:image:width" content="<%= @post.image_width %>">
|
<meta name="twitter:title" content="<%= @post.presenter.humanized_essential_tag_string %> - <%= Danbooru.config.app_name %>">
|
||||||
<meta name="twitter:image:height" content="<%= @post.image_height %>">
|
<meta name="twitter:description" content="<%= @post.presenter.humanized_tag_string %> - <%= Danbooru.config.app_name %>">
|
||||||
|
<meta name="twitter:image" content="http://<%= Danbooru.config.hostname %><%= @post.large_file_url %>">
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|||||||
@@ -392,5 +392,9 @@ module Danbooru
|
|||||||
false
|
false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def twitter_site
|
||||||
|
"@teruyo"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user