I need help with Facebook integration for my Webflow Blog

Hello

I have small problem with my social media share integration. I’d like to set up Facebook Share in dynamic template page. But all share going only for same blog post, because facebook generate this code

<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/en_US/sdk.js#xfbml=1&version=v2.6";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<div class="fb-share-button" data-href="http://discovermybusiness.co/blog/google-calories-calculator" data-layout="button_count" data-mobile-iframe="true"></div>

Maybe problem with div class=“fb-share-button” here?


Here is my public share link: https://preview.webflow.com/preview/discovermybusiness?preview=16b10b3ccf0975f9cff19949d1a63379

You might find the information you need here: How to integrate Facebook comments into dynamic template - #21 by thewonglv - Custom code - Forum | Webflow

Best,
Christopher

Either do the above, or:

For this line:

<div class="fb-share-button" data-href="http://discovermybusiness.co/blog/google-calories-calculator" data-layout="button_count" data-mobile-iframe="true"></div>

Change it to:

<div class="fb-share-button" data-href="" data-layout="button_count" data-mobile-iframe="true"></div>
<script>
var Webflow = Webflow || [];
Webflow.push(function() {
  $('.fb-share-button').attr('data-href', location.href);
});
</script>
1 Like

Thank you samliew It is really help, right now I can share each post!)
So the main problem does not write any href link !)

Thank you Again !!!

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.