Twitter分享链接不起作用

时间:2017-09-11 10:09:02

标签: php codeigniter twitter share-button twitter-share

我希望我的tweeter分享按钮能够像推文实际显示图像,标题和描述一样工作。我已经给了Twitter卡,但它没有工作,我不明白为什么。我的G +工作正常,我在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代替状态,但仍然没有运气

 <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变量看起来像这样
  

数组([client_id] =&gt; 1 [名称] =&gt; Shikhar Dhawan [image] =&gt;   shikhar-dhawan-759.jpg [video] =&gt; [content1] =&gt; &#34;营养起着关键作用   在我的恢复和表现中的作用。使用Sports Gene测试和   推进营养血液生化帮助我。吃着计划   以这种方式变得更加科学和结果导向。&#34;

现在我不明白为什么Twitter卡不起作用。我以完全相同的方式做了G +并且完美地工作了。任何人都可以建议如何解决这个问题?

2 个答案:

答案 0 :(得分:0)

请在锚标记中将“status”替换为“url”。

答案 1 :(得分:0)

首先,您必须确保元标记在您共享的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 forumsdocumentation site的问题排查建议。