How do I place social media links to share a post link?

Asked

Viewed 1,773 times

2

I have a question. I don’t know much about ASP.Net, but a friend of mine asked for help to implement some social networking buttons on his TCC site. His TCC is a news portal, like any other.

He would like to put on each post page something like:

Botões de redes sociais para compartilhamento.

Together with the button Whatsapp.

The purpose is to share each post page, IE, has post x, they share the link x, and in the post y, they share the link y of the post y.

Thanks in advance!!

  • 1

    In each post individually? or in list?

  • In each post individually!

1 answer

1


Each social network works in a different way. In the case of Twitter, you can use something like this javascript code:


<a href="https://twitter.com/share" 
class="twitter-share-button" 
data-url="http://seusite.com/noticia/id" 
data-via="seuarroba" data-related="seuarroba" 
data-hashtags="minhaHashtag">
Tweet
</a>   
<script>!function(d,s,id){
  var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';
  if(!d.getElementById(id)){
    js=d.createElement(s);
    js.id=id;js.src=p+'://platform.twitter.com/widgets.js';
    fjs.parentNode.insertBefore(js,fjs);
  }
}(document, 'script', 'twitter-wjs');
</script>

just replace the values of the data-url parameters by the news link, 'data-via' by the twitter profile referring to the site, data-Related by the profile to be indicated (for other people to follow) and data-hashtags by the hashtags (if any)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.