Facebook as a meta problem

I am trying to add the facebook button as the website I am running on, but none of the meta attributes that I add appear.

I have the following in my html, (irrelevant parts are not included)

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:og="http://opengraphprotocol.org/schema/"
      xmlns:fb="http://www.facebook.com/2008/fbml">

<head>
...
<meta property="og:site_name" content="My Site" /> 
<meta property="og:title" content="Some Product"/> 
...
</head>

<body>
<div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
    FB.init({
      appId  : 'MYAPIKEY',
      status : true, // check login status
      cookie : true, // enable cookies to allow the server to access the session
      xfbml  : true  // parse XFBML
    });
  };

  (function() {
    var e = document.createElement('script');
    e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js#xfbml=1';
    e.async = true;
    document.getElementById('fb-root').appendChild(e);
  }());
</script> 
...
...
<fb:like layout="button_count"></fb:like>
...

Any pointers to what I am doing wrong will be greatly appreciated.

+3
source share
3 answers

I realized the problem was that I tested the machine on my local computer. It started working as soon as I posted the website on the Internet.

+2
source

Putting a Facebook Page

http://developers.facebook.com/docs/guides/web

It should look like this:

<iframe src="http://www.facebook.com/widgets/like.php?href=http://example.com"
        scrolling="no" frameborder="0"
        style="border:none; width:450px; height:80px"></iframe>
0
source

. . -

<meta property="og:title" content="Title of page"/>
<meta property="og:type" content="CONTENT TYPE"/>
<meta property="og:url" content="URL of PAGE"/>
<meta property="og:image" content="URL of IMAGE"/>
<meta property="og:site_name" content="SITE NAME"/>
<meta property="fb:admins" content="USER_ID"/>
0
source

Source: https://habr.com/ru/post/1774694/


All Articles