微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Twitter 未正确显示 summary_large_image 卡片

如何解决Twitter 未正确显示 summary_large_image 卡片

我正在尝试让大图像卡片与网站配合使用。元数据被正确读取,但显示的是小摘要卡。

我的元数据:

<!-- Twitter Card -->
<Meta name="twitter:card" content="summary_large_image">
<Meta property="twitter:domain" content="volkischexe.com">
<Meta property="twitter:url" content="/germania/index.PHP">
<Meta name="twitter:title" content="Germania: An Introduction">
<Meta name="twitter:description" content="...">
<Meta name="twitter:image" content="http://volkischexe.com/res/cards/germania-intro.png?605a78eeba1aa">

<!-- OpenGraph Card -->
<Meta property="og:type" content="website">
<Meta property="og:url" content="/germania/index.PHP">
<Meta property="og:title" content="Germania: An Introduction">
<Meta property="og:image" content="http://volkischexe.com/res/cards/germania-intro.png?605a78eeba1ae">
<Meta property="og:description" content="...">

<!-- HTML Meta -->
<title>Germania: An Introduction</title>
<Meta property="og:url" content="http://volkischexe.com/germania/">
<Meta property="og:image" content="http://volkischexe.com/res/cards/germania-intro.png?605a78eeba1b1">
<Meta property="og:title" content="Germania: An Introduction">
<Meta property="og:description" content="...">  
<Meta name="description" content="...">
<title>Germania: An Introduction</title>

Twitter 似乎也正确地看到了我的元数据:

enter image description here

在这里遗漏了什么?

ETA:验证器没有正确显示我的卡片,但如果我真的在推特上显示它们,它们显示得很好。所以验证器出了点问题,但只要我的卡片出现在 Twitter 上,我就很好。

解决方法

有几件事可能会阻止 Twitter 为您的网站共享大卡片:

  • 您的一些 Twitter 元设置使用“内容”,但 twitter 想要“名称”。
  • 您的网站正在重定向到 https,因此请对元信息中的网址使用安全版本。
  • 最好包含 Facebook 的图片大小。
  • 而且您不需要 index.php 文件名 - 您的服务器将自动提供 index.php 文件。

尝试用这个替换你的代码:

<!-- OpenGraph Card -->
<meta property="og:type" content="website">
<meta property="og:url" content="https://volkischexe.com/germania/">
<meta property="og:title" content="Germania: An Introduction">
<meta property="og:image" content="https://volkischexe.com/res/cards/germania-intro.png?605e46b26abc5">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:description" content="From where does the modern Western world derive its values and morals?">

<!-- Twitter Card -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:domain" content="volkischexe.com">
<meta name="twitter:url" content="https://volkischexe.com/germania/">
<meta name="twitter:title" content="Germania: An Introduction">
<meta name="twitter:description" content="From where does the modern Western world derive its values and morals?">
<meta name="twitter:image" content="https://volkischexe.com/res/cards/germania-intro.png?605e46b26abc1">

有一件事(可能会或可能不会影响 Twitter)是您页面的开头缺少 DOCTYPE 和其他一些内容:

<!DOCTYPE html>
    <html lang="en">

    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width,initial-scale=1.0">
        <title>Germania: An Introduction</title>
        <meta name="description" content="From where does the modern Western world derive its values and morals?">

        <link rel="preload" href="/res/AndBasR.ttf" as="font" type="font/ttf" crossorigin>
        <link rel="preload" href="/res/CelticHand.ttf" as="font" type="font/ttf" crossorigin>
        <link rel="preload" href="/res/Norse-Bold.otf" as="font" type="font/otf" crossorigin>

        <link rel="stylesheet" href="/res/main.css">

        <script src="/res/main.js"></script>

Twitter card validator 的一件事是,当您单击预览卡按钮时,有时不会重新抓取您的网站。您可能需要重新启动浏览器(关闭并重新打开)并重新抓取几次才能加载新版本。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?