Why won't my link previews work on Twitter?

 

Twitter Card Validator

Ever noticed how previews fail to materialise when sharing links on Twitter? It's because your website doesn't have "Twitter Cards" enabled.

I did what I always do and searched Google for "why won't my blogger links preview on twitter" and eventually found the "Twitter Card Validator" (pictured above).

Enter the link in the validator, and if it comes up with image above, then your website needs some code added to it.

I found the code for Blogger sites here.

<!--Twitter Card-->
<b:if cond='data:blog.pageType == "index"'> <!--homepage-->
<meta name="twitter:card" content="summary" />
<meta name="twitter:description" expr:content='data:blog.metaDescription' />
<meta name="twitter:title" expr:content="data:blog.pageTitle" />
<meta name="twitter:site" content="@username" />
<meta name="twitter:image" content="YOUR_LOGO_URL" />
<meta name="twitter:creator" content="@username" />
</b:if>
<b:if cond='data:blog.pageType == "static_page"'> <!--page-->
<meta name="twitter:card" content="summary" />
<meta name="twitter:description" expr:content='data:blog.metaDescription' />
<meta name="twitter:title" expr:content="data:blog.pageTitle" />
<meta name="twitter:site" content="@username" />
<meta name="twitter:image" content="YOUR_LOGO_URL" />
<meta name="twitter:creator" content="@username" />
</b:if>
<b:if cond='data:blog.pageType == "item"'> <!--blog post-->
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:description" expr:content='data:blog.metaDescription' />
<meta name="twitter:title" expr:content="data:blog.pageName" />
<meta name="twitter:site" content="@username" />
<meta name="twitter:image" expr:content="data:blog.postImageUrl" />
<meta name="twitter:creator" content="@username" />
</b:if>

<!--End Twitter Card-->  

Paste it immediately before the </head> tag. Replace all instances of @username with your Twitter username and all instances of YOUR_LOGO_URL with your actual URL. 

Although my Blogger site is actually at madepercy.blogspot.com, I used my alias address of politicalscience.com.au and it worked just fine.

I hope this is useful. All credit to https://jumiaafrica.blogspot.com/2020/03/how-to-add-twitter-cards-to-blogger-and.html - thanks for this, its been bugging me for years!