Dynamically adding meta tags using javascript or jquery [twitter cards]


#1

I want to add twitter card meta tags to my website. i cannot add static tags since the content attribute in the meta tag has to change dynamically.


#2

Hello Mani,

You can’t add the Twitter Cards markup using client-side JavaScript since the Twitterbot will fetch your page and analyze the markup on the server without rendering the pages.

However, you are more than welcome to dynamically populate the Twitter Cards tags on the server-side itself. If you’re using a programming language to serve your pages, you can definitely add the tags at this stage. Alternatively, if you’re using a blog engine or a CMS, you’ll likely find some plugins to add Twitter Cards for you.

Let us know if we can help further.

Thanks,
Romain


#3

Thanks for quick answer. Now i had one product page with 100 product-list. Here , i need to implement the image-tweet process to all products? Any possible…for website?