代码之家  ›  专栏  ›  技术社区  ›  Zander

为什么我的类似Facebook的按钮会创建一个全新的Facebook页面?

  •  3
  • Zander  · 技术社区  · 15 年前

    我使用FBML在我的站点的页脚添加一个推荐按钮,这样用户就可以推荐特定的页面,但是当我单击它时,它会为该URI创建一个全新的Facebook页面&似乎忽略了所有的facebook&打开图形元标记信息。

    仅供参考,以下是我使用的元标记:

    <meta property="og:title" content="My Page title"/>
    <meta property="og:type" content="company"/>
    <meta property="og:url" content="http://mysite.com/"/>
    <meta property="og:image" content="http://mysiteimage.jpg"/>
    <meta property="og:site_name" content="My Site Name"/>
    <meta property="fb:admins" content="My_FB_Admin_ID"/>
    <meta property="fb:page_id" content="My_FB_Page_ID" />
    <meta property="fb:app_id" content="My_FB_App_ID" />
    <meta property="og:description" content="Desctiption of page"/>
    

    这是我使用的FBML:

    <fb:like width="940" action="recommend" font="lucida grande"></fb:like>
    

    </body> 标记(每页仅添加一次):

    <div id="fb-root"></div>
    <script>
        window.fbAsyncInit = function() {
            FB.init({appId: 'My_FB_App_ID', status: true, cookie: true,
            xfbml: true});
        };
        (function() {
            var e = document.createElement('script'); e.async = true;
            e.src = document.location.protocol +
            '//connect.facebook.net/en_US/all.js';
            document.getElementById('fb-root').appendChild(e);
        }());
    </script>
    

    我还真的很想能够'喜欢/推荐'的网站上的实际Facebook页面,这是可能的吗?

    非常感谢。

    2 回复  |  直到 15 年前
        1
  •  6
  •   ohaal soulmerge    14 年前

    meta og:type article 像视频/音频等将在开放的社交图上创建一个新的Facebook页面。

    如果你设置 文章 ,或将其全部删除,问题将消失。

    我希望这有帮助。

        2
  •  0
  •   Agent_x    15 年前

    在放置“like”按钮的任何位置,您都不能在上面指定url,因此以这种方式只创建一个“page”,例如:

    your created html location = http://mywebsite.com
    some other stuff
    
        <!-- like button -->
    
         <fb:like href="http://mywebsite.com" layout="button_count" show_faces="false" width="200" font="lucida grande"></fb:like>
    
        <!-- end like button -->
    
    
    your other created html location = http://mywebsite.com/help
    
    some other stuff
    
        <!-- like button -->
    
         <fb:like href="http://mywebsite.com" layout="button_count" show_faces="false" width="200" font="lucida grande"></fb:like>
    
        <!-- end like button -->
    

    记住,如果你指定了url和相同的内容,即使是“meta property”标签也会创建相同的页面,如果你将某个部分留空,facebook api将测量当前的url,而不会接受任何其他参数。这同样适用于注释如果你指定了url,你可以在相同的注释框中包含相同的注释。

    推荐文章