Streaming live at 10am (PST)

How to add FB social share icon?


#1

How to add social share icon?

When i embeded this code (with the embed block) i get JS errors
https://developers.facebook.com/docs/plugins/share-button#configurator


#2

Hey @Siton_Systems,

Put this code in the head of your page

<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/fr_FR/sdk.js#xfbml=1&version=v2.10";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

And this code in an embeded

<div class="fb-share-button" data-href="https://developers.facebook.com/docs/plugins/" data-layout="button_count" data-size="small" data-mobile-iframe="true"><a class="fb-xfbml-parse-ignore" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2Fplugins%2F&amp;src=sdkpreparse">Partager</a></div>

Hope this helps


#3

Thanks. I hope in the future Webflow will add Share block beacuse “by code” sometimes the FB could change.


#6

Thanks that works, but I suggest to make the code for the embed like this (if used inside the cms template):
(in this case and after using your cms page address you will have a facebook white icon as SVG image in size 22 px/ size can be adjusted in the code also)

<div class="fb-share-button" data-href="https://www.yourwebsite.com/your cms template address/YOUR SLUG (added from add field in the code window" data-layout="button_count" data-size="small" data-mobile-iframe="true"><a class="222" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=https://www.yourwebsite.com/your cms template address/YOUR SLUG (added from add field in the code window"><img src="https://uploads-ssl.webflow.com/5b98c4400f6a63c23a0ebcab/5b98c4400f6a63277e0ebcb4_facebook-icon.svg" title="Share on facebook" width="22"height="22" /></a></a></div>

thanks
[/quote]

thanks