1

Like normal web applications I want to implement social sharing by providing share button for this I have defined the meta tag in my current html component but It's not showing the image. I think in angular there is some different way of implementing social sharing.

share.component.html

<meta name="twitter:card" content="summary"/>  <!-- Card type -->
<meta name="twitter:site" content="Pratyashi"/>
<meta name="twitter:title" content="Pratyashi From Title">
<meta name="twitter:description" content="Description" />
<meta name="twitter:creator" content="Creater"/>
<meta name="twitter:type" content="image"/>
<meta name="twitter:image:src" content="https://www.gstatic.com/webp/gallery3/1_webp_a.png" />
<meta name="twitter:domain" content="http://vmandi.com" />

<a href="https://twitter.com/intent/tweet?ref_src=twsrc%5Etfw&text=Title&tw_p=tweetbutton&url=mywesite"  target="_blank">tWITTER</a>

1 Answers1

0

This code just displays a text : Twitter which takes to a link. If you want image associated with it, just add an <img> tag. And kindly explain what you actually want to do. meta tag is mainly for SEO purpose.

More about meta tags: https://developer.mozilla.org/en-US/docs/Learn/HTML/Introduction_to_HTML/The_head_metadata_in_HTML

Hope it helps: Angular6 Social Share Demo

  • I just want to post a link along with image –  Dec 03 '18 at 10:40
  • how, can you please explain it by an example please –  Dec 03 '18 at 12:58
  • https://www.npmjs.com/package/url-metadata install this package in your backend (if you are using node) and then set the fetched image to front, calling a service. –  Dec 03 '18 at 13:12