modify meta tag according to the twitter doc to return large images (#8858)

This commit is contained in:
Raphael Noriode 2020-06-23 18:03:28 +01:00 committed by GitHub
parent d25a506b6d
commit 463cd07597
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -12,6 +12,7 @@
<meta property="og:title" content="Discussion of <%= @commentable.title %>" />
<meta property="og:description" content="<%= @commentable.description || "#{community_name} Comment" %>" />
<meta property="og:site_name" content="<%= community_qualified_name %>" />
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@<%= SiteConfig.social_media_handles["twitter"] %>">
<meta name="twitter:creator" content="@<%= @user.twitter_username %>">
<meta name="twitter:title" content="<%= @commentable.title %>">
@ -23,7 +24,7 @@
<meta property="og:title" content="<%= truncate(strip_tags(@root_comment.processed_html), length: 50) %> — <%= community_name %>" />
<meta name="twitter:title" content="<%= truncate(strip_tags(@root_comment.processed_html), length: 50) %> — <%= community_name %>">
<meta property="og:image" content="<%= comment_social_image_url(@root_comment) %>" />
<meta name="twitter:image:src" content="<%= comment_social_image_url(@root_comment) %>">
<meta name="twitter:image" content="<%= comment_social_image_url(@root_comment) %>">
<% else %>
<link rel="canonical" href="<%= app_url("#{@commentable.path}/comments") %>" />
<meta property="og:url" content="<%= app_url("#{@commentable.path}/comments") %>" />
@ -31,7 +32,7 @@
<meta name="twitter:title" content="[Discussion] <%= @commentable.title %> — <%= community_name %>">
<% if @commentable.class.name == "Article" && @commentable.published %>
<meta property="og:image" content="<%= article_social_image_url(@commentable) %>" />
<meta name="twitter:image:src" content="<%= article_social_image_url(@commentable) %>">
<meta name="twitter:image" content="<%= article_social_image_url(@commentable) %>">
<% end %>
<% end %>
<% end %>