How to put links from social networks to share the link of the page of a post?

2

I have a question. I do not understand much about ASP.Net, but a friend of mine asked for help to implement social networking buttons on his TCC site. His CBT is a news portal like any other.

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

Together with the WhatsApp button.

The intention is to share each page of post, ie have post x, they share the link x, and in the post y, they share the link and post and y.

Thank you in advance !!

    
asked by anonymous 21.09.2017 / 17:32

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>

Simply replace the data-url parameter values with the news link, 'data-via' by the twitter profile for the site, data-related by the profile to be indicated (for others to follow) data-hashtags' through the hashtags (if any)

    
22.09.2017 / 16:17