Sunday, 18 December 2016

Facing Required meta tag missing (twitter:text:description) Error in your Blogger?

Are you facing issue in setting up Twitter Card for your blog hosted on Blogger? If yes, then this blog post may help you on this.



You will find below code snippet everywhere to setup Twitter Card for your blog. Add below code snippet before </head> tag in your template.

<!-- twitter card details -->
<meta content='summary' name='twitter:card'/>
<meta content='@ThakkarNilesh' name='twitter:site'/>
<meta expr:content='data:blog.url' name='twitter:url'/>
<meta expr:content='data:blog.pageName' name='twitter:title'/>
<meta expr:content='data:blog.metaDescription' name='twitter:description'/>
<meta expr:content='data:blog.postImageThumbnailUrl' name='twitter:image'/>
<!-- end twitter card details -->

But once you add this code snippet, the very next moment you will below error when you validate your twitter card through card validator at https://cards-dev.twitter.com/validator

meta tag missing (twitter:text:description)

If you are facing similar error then you can fix it by surrounding your code with condition as suggested below.

<!-- twitter card details -->
<meta content='summary' name='twitter:card'/>
<meta content='@ThakkarNilesh' name='twitter:site'/>
<meta expr:content='data:blog.url' name='twitter:url'/>
<meta expr:content='data:blog.pageName' name='twitter:title'/>
<b:if cond='data:blog.metaDescription'>
<meta expr:content='data:blog.metaDescription' name='twitter:description'/>
</b:if>
<meta expr:content='data:blog.postImageThumbnailUrl' name='twitter:image'/>
<!-- end twitter card details -->

Now try to validate your twitter card again at https://cards-dev.twitter.com/validator
Hurray... It's showing twitter card. right?

Now enjoy sharing your twitter card!

3 comments:

  1. Thnaks for providing neat content.. I am very happy as i found thiblog. i found your site in google search while searching for my web designing companies in karimnagar website.. Its nice thanks...

    ReplyDelete
    Replies
    1. Good to hear that it helped you Meerja!

      Delete
  2. Thanks for providing this. As my blog is in WordPress - I used the Plugin. Good to know what is required for twitter cards.

    ReplyDelete