Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twitter: Twitter cards not showing image after tweet post

I am trying to share the tweet using twitter share button and using twitter cards for post image with my link and i am using :

<meta property="og:image" content="https://farm6.staticflickr.com/5510/14338202952_93595258ff_z.jpg">
<meta property="og:title" content="SOME TEXT">
<meta property="og:description"SOME DESCRIPTION">
<meta name="twitter:site" content="THIS IS CONTENT">
<meta name="twitter:card" content="photo" />
<meta name="twitter:title" content="TWITTER CONTENT">
<meta name="twitter:description" content="TWITTER DESCRIPTION">
<meta name="twitter:image" content="https://farm6.staticflickr.com/5510/14338202952_93595258ff_z.jpg">

and for share button using this:

<a class="twitter-share-button"href="https://twitter.com/intent/tweet?text=Hello%20world">Tweet</a>
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>

but this code only sharing text and link on twitter not with image.

can any one tell me whats wrong with my code?

like image 356
Rahul Sharma Avatar asked Jan 19 '17 10:01

Rahul Sharma


People also ask

Why is my twitter card not showing?

My Card does not appear in the timeline.Twitter Cards generated from developer meta tags only appear when a Tweet is either expanded in the timeline (on web) or viewed on the Tweet's individual permalink page (by clicking on the date from the timeline, either on web or on mobile).

How do Twitter Cards work?

With Twitter Cards, you can attach rich photos, videos and media experiences to Tweets, helping to drive traffic to your website. Simply add a few lines of markup to your webpage, and users who Tweet links to your content will have a “Card” added to the Tweet that's visible to their followers.

Why is my link not previewing on Twitter?

Typically if the link's website has Twitter Cards enabled a preview should display. To verify if the site you are linking to has a Twitter Card, and to see what it will look like, enter the link into Twitter's Card validator. Learn more about Twitter Cards, and how to add them to your website.


2 Answers

I just solved this issue by changing the tag name:

<meta name="twitter:image:src" content="https://example.com/img/my_image.jpg">

It seems the documentation is showing twitter:image instead of twitter:image:src.

like image 119
eFox Avatar answered Sep 22 '22 23:09

eFox


First, try to use complete path from http or https for example: https://webpage.com/my_path_image.jpg

Check directly in the following links:

Twitter: https://cards-dev.twitter.com/validator

Facebook: https://developers.facebook.com/tools/debug/

like image 32
Antonio Moreno Avatar answered Sep 25 '22 23:09

Antonio Moreno