我正在进行卡片预览,但是当我发布推文时,我没有得到照片。可以找出丢失的内容。任何帮助都是可以理解的
application.html
<% if content_for?(:head) %>
<%= yield(:head) %>
<% end %>
的index.html
<% @feeds.each_with_index do |feed,i| %>
<div>
<% content_for :head do %>
<meta name="twitter:card" content="summary" />
<meta name="twitter:title" content="<%= feed["title"] %>" />
<meta name="twitter:description" content="<%= feed["description"] %>" />
<meta name="twitter:image" content="<%= feed["image"].present? ? feed["image"] : feed["json_data"]["img"] %>" />
<meta name="twitter:url" content="http://<%= select_url %>/entry/<%= feed["slug"]%>" />
<meta property="og:url" content="http://<%= select_url %>/entry/<%= feed["slug"]%>" />
<meta property="og:image" content="<%= feed["image"].present? ? feed["image"] : feed["json_data"]["img"] %>" />
<meta property="og:image:width" content="400" />
<meta property="og:image:height" content="300" />
<meta property="og:title" content="<%= feed["title"] %>" />
<% end %>
</div>
<% end %>
<% end %>