Address #3415: og:image meta tags can point to video files.
This commit is contained in:
@@ -196,6 +196,14 @@ class Post < ApplicationRecord
|
||||
"http://#{Danbooru.config.hostname}#{preview_file_url}"
|
||||
end
|
||||
|
||||
def open_graph_image_url
|
||||
if is_image? && has_large?
|
||||
"http://#{Danbooru.config.hostname}#{large_file_url}"
|
||||
else
|
||||
complete_preview_file_url
|
||||
end
|
||||
end
|
||||
|
||||
def file_url_for(user)
|
||||
if CurrentUser.mobile_mode?
|
||||
large_file_url
|
||||
|
||||
@@ -174,7 +174,7 @@
|
||||
<meta property="og:title" content="<%= @post.presenter.humanized_essential_tag_string %> - <%= Danbooru.config.app_name %>">
|
||||
|
||||
<% if @post.visible? %>
|
||||
<meta property="og:image" content="http://<%= Danbooru.config.hostname %><%= @post.large_file_url %>">
|
||||
<meta property="og:image" content="<%= @post.open_graph_image_url %>">
|
||||
<% end %>
|
||||
|
||||
<% if Danbooru.config.enable_post_search_counts %>
|
||||
@@ -189,7 +189,7 @@
|
||||
<meta name="twitter:description" content="<%= @post.presenter.humanized_tag_string %> - <%= Danbooru.config.app_name %>">
|
||||
|
||||
<% if @post.visible? %>
|
||||
<meta name="twitter:image" content="http://<%= Danbooru.config.hostname %><%= @post.large_file_url %>">
|
||||
<meta name="twitter:image" content="<%= @post.open_graph_image_url %>">
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user