Twitter 分享 link 无效

Twitter share link not working

我希望我的推特分享按钮像推文实际显示图像、标题和描述一样工作。我已经提供了 Twitter 卡片,但它不起作用,我不明白为什么。我的 Google+ 运行良好,但我在 Twitter 和 Facebook 分享方面遇到了一些问题。

我的 Twitter 分享锚标签在下面

<a class="fa fa-twitter" href="https://twitter.com/intent/tweet?status=<?php echo base_url(); ?>index.php/Testimonials/fb_share/<?php echo $row->client_id; ?>" target="_blank"><i class="icomoon-icon-twitter"></i><span class="share-title"></span></a>

我也试过用 url 代替 status 但还是不行

 <a class="fa fa-twitter" href="https://twitter.com/intent/tweet?url=<?php echo base_url(); ?>index.php/Testimonials/fb_share/<?php echo $row->client_id; ?>" target="_blank"><i class="icomoon-icon-twitter"></i><span class="share-title"></span></a>

我的 Twitter 卡片如下

  <!-- Twitter Card data -->
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="http://quanutrition.com/Dotcom/new/">
<meta name="twitter:title" content="<?php echo $res['name'];?>">
<meta name="twitter:description" content="<?php echo $res['content1'];?>">
<meta name="twitter:creator" content="@author_handle">
<meta name="twitter:image" content="http://quanutrition.com/Dotcom/new//admin/assets/uploads/clients_image/<?php echo $res['image'];?>">
<!-- Twitter summary card with large image must be at least 280x150px -->
<meta name="twitter:image:src" content="http://quanutrition.com/Dotcom/new//admin/assets/uploads/clients_image/<?php echo $res['image'];?>">

对于特定的 client_id

,$res 变量看起来像这样

Array ( [client_id] => 1 [name] => Shikhar Dhawan [image] => shikhar-dhawan-759.jpg [video] => [content1] => "Nutrition plays a key role in my recovery and performance. Using Sports Gene testing and advance nutritional blood biochemistry helps me. Eating with a plan gets more scientific and result oriented this way."

现在我不明白为什么 Twitter 卡片不起作用。我以完全相同的方式完成了 G+,并且效果很好。有人可以建议如何解决这个问题吗?

请将锚标记中的 "status" 替换为 "url"。

首先,您必须确保您的元标记在您共享的 URL 的最终静态输出中可用。

在一个示例推荐页面的情况下 http://quanutrition.com/Dotcom/new/index.php/Testimonials/fb_share/4 我看到了这个:

<meta name="twitter:card" content="summary_large_image"> <meta name="twitter:site" content="http://quanutrition.com/Dotcom/new/"> <meta name="twitter:title" content="S. Danush"> <meta name="twitter:description" content=""Qua Nutrition has helped me grow physically, sports-wise in a healthy manner and explore my strength through right nutrition. I thank my vibrant coach Mr.Veerabadran, who showed me the way to Qua Nutrition and thank my Nutritionist Suhasini for her dedicated support and guidance in helping me achieve my dream. The systematic approach of dietitians and minuscule study of body elements are the strengths of QUA. Wish that every athlete gets an opportunity to visit Qua Nutrition and get the best out of them!" "> <meta name="twitter:creator" content="@author_handle"> <!-- Twitter summary card with large image must be at least 280x150px --> <meta name="twitter:image:src" content="http://quanutrition.com/Dotcom/new//admin/assets/uploads/clients_image/DanushS.jpg">

twitter:description 标签已损坏,因为它在 content 的值的两边都有一个双引号。

twitter:creator 标签是通用的。

twitter:image:src 标签名称应为 twitter:image。这是在卡片 documentation.

Twitter Card Validator 中测试您的链接会导致: ERROR: Failed to fetch page due to: DnsResolutionRequestTimeout

这可能是因为您的主机阻止了 Twitter 的 IP 地址,或者您的域的 DNS 解析速度较慢(5 秒以上)。

Twitter's developer forums and documentation site 上有故障排除建议。