即使存在元标记,也不会呈现Twitter卡

时间:2015-12-11 17:03:28

标签: html twitter opengraph twitter-card

尝试创建推特卡。我在页面的标题中有以下元标记。出于某种原因,当我把链接放在我的推文中时,Twitter卡没有被渲染。有什么建议吗?

<!--- og: tags to create nice facebook & twitter posts for an auction --->
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@herberzt_dev" />
<meta name="twitter:creator" content="@herberzt_dev" />
<% if !@item.nil? %>
    <meta property="og:title" content="<%= @item.name %>"/>
    <meta property="og:type" content="website"/>
    <meta property="og:url" content="<%= request.original_url %>"/>
    <meta property="og:image" content="<%= @item.photo(:thumbnail) %>"/>
    <meta property="og:description" content="<%= @item.description %>"/>
    <meta name="twitter:site" content="@herberzt_dev">
<% elsif !@auction.nil? %>
    <meta property="og:title" content="<%= @auction.name %>"/>
    <meta property="og:type" content="website"/>
    <meta property="og:url" content="<%= request.original_url %>"/>
    <meta property="og:image" content="<%= @auction.photo %>"/>
    <meta property="og:description" content="<%= @auction.description %>"/>
<% end %>

1 个答案:

答案 0 :(得分:0)

应该这一行;

<% elsif !@auction.nil? %> 

是:

<% elseif !@auction.nil? %>