0

I am using the default facebook share button to pop-open a window to share a link on people's pages. However, my og data isn't showing up. It's just showing default data. Here is the page source I'm using...

<html>
<head>
<meta property="og:title" content="here is a title" />
<meta property="og:url" content="http://www.trivialgaming.com/index.htm" />
<meta property="og:image" content="http://www.trivialgaming.com/bleh.jpg" />
</head>

<body>


<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/all.js#xfbml=1&appId=424402201029167";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>


<div class="fb-share-button" data-href="https://www.trivialgaming.com/index.htm" data-type="button"></div>


</body>
</html>
Robby Mulvany
  • 59
  • 1
  • 3

3 Answers3

0

Include the JavaScript SDK on your page once, ideally right after the opening tag.

The Facebook SDK for JavaScript provides a rich set of client-side functionality for adding Social Plugins, making API calls and implementing Facebook Login.

Nadeem Ilyas
  • 21
  • 1
  • 5
0

Ok, try assembling all the pieces to this bit of code which you can use to replace the code you included for the share button:

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

<li id="social_facebook">
<div class="social_action">
<div class="fb-share-button" data-href="http://shopmoonfall.bigcartel.com{{ product.url       }}" data-type="button"></div>
</div>
</li>
Nadeem Ilyas
  • 21
  • 1
  • 5
0
<a title="Share on Facebook" href="javascript:void(0);" onClick="return share();" >Share with Facebook</a>
                <script  type="text/javascript">
                function share()
                {
                    FB.ui({ method: 'feed',
                    link: '//Link of the page',
                    picture: //image link,
                    name: 'Title',
                    caption: "//caption of the photo",
                    description: "//Description"
                    },function(response){
                        }
                    });
                }
                </script> 

Just use this code and place the your code on the commented place.

you dont need to add OG data. thank me later.

Subhod30
  • 390
  • 2
  • 3
  • 14