& lt; fb:like& gt;的问题页面标题,如计数和页面网址 [英] Trouble with <fb:like> page title, like count, and page url

查看:71
本文介绍了& lt; fb:like& gt;的问题页面标题,如计数和页面网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站上有一组页面,这些页面使用FBML方法插入FB Recommend按钮.我的问题是,我网站上的每个页面都显示完全相同的推荐计数(即使我刚刚安装了按钮,"557个人推荐此页面"),并且当我尝试自己推荐它时,它就会显示在我的新闻提要中错误的页面标题,错误的URL,当然,网站上的每个推荐"按钮也会增加.这是我的代码:

I have a set of pages in my site that are using the FBML method of inserting a FB Recommend button. My problem is that every page on my site shows the exact same recommend count ("557 people recommend this page" even though I just installed the button), and when I've tried to Recommend it myself, it shows up in my news feed with the wrong page title, the wrong URL, and of course, every recommend button on the site is incremented. Here is my code:

og标记(我用匿名值替换了这些标记,以防止客户端看起来像个白痴开发人员);)

og tags (I replaced these with anonymous values to protect my client from looking like they have an idiot developer) ;) :

    <meta property="og:title" content="XXX page title"/>
    <meta property="og:type" content="movie"/>
    <meta property="og:url" content="http://abc.xyz.com/path/to/my/page/"/>
    <meta property="og:site_name" content="XXX site name"/>
    <meta property="fb:admins" content="xxx my facebook id"/>
    <meta property="og:description" content="xxx short description"/>

...然后就在体内:

...then just inside the body:

<body>
<div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
    FB.init({
      appId  : 'xxxxx',
      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';
    e.async = true;
    document.getElementById('fb-root').appendChild(e);
  }());
</script>

...然后在页面的后面(我使用FBML方法的唯一原因是,我可以跟踪google Analytics(分析)中的推荐事件-这应该无关紧要,但出于全面披露的目的,我也在此处包含该代码)...

...and then later on in the page (the only reason I'm using the FBML method is so I can track the recommend events in google analytics -- this should be unrelated, but for the purposes of full disclosure, I'm including that code here too)...

<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
        <script type="text/javascript">
            FB.Event.subscribe('edge.create', function(href, widget) {
                _gaq.push(['_trackEvent', '<?php echo $item->type ?>', 'Facebook Recommend', '<?php echo $item->title ?>']);
            });
        </script>
<!-- FB LIKE BUTTON INSERTED HERE -->
        <fb:like href="<?php echo urlencode('http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] )?>" show_faces="false" width="450" action="recommend" font="arial" colorscheme="dark"></fb:like>

我的Feed中显示的链接是 http://abc.xyz.com/path/to/my/(URL的最后一段丢失),标题是旧的;我意识到在设置时所有页面都具有相同的标题,因此我给它们起了不同的标题.我已经通过URL linter运行了几个URL,并且没有错误,并且所有数据看起来都是正确的.

The link that shows up in my feed is http://abc.xyz.com/path/to/my/ (the last segment of the URL is missing), and the title is an old one; I realized that all the pages had the same title when I was setting this up, and so I gave them different titles since. I have run several of my URLs through the URL linter and there are no errors, and all the data looks correct.

推荐答案

这里有两个注释:

  1. 由于您使用URL Linter检查了多个URL,并且结果如预期的那样出现,这意味着这是一个缓存问题,请阅读). /li>
  1. Since you checked several URLS using the URL Linter and the result came up as expected this means it's a caching problem, read this.
  2. If you are not using Facebook Graph API...or any Facebook related services other than the Like Plugin, then the first Facebook Javascript initialization snippet is not needed but if it's used then (<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>) is not needed.


根据评论,某些页面有50多个赞,这意味着您无法再更改title:


Based on the comments, some of the pages have more than 50 likes this means you can't change the title anymore:

您可以更新自己的属性 通过更新页面的页面 标签.注意og:title和og:type 最初只能编辑-之后 您的页面获得50个赞标题 变得固定,并且在您的页面之后 收到10,000个喜欢的类型变为 固定的.这些属性固定为 避免让喜欢的用户感到惊讶 该页面已经.更改标题 或在这些限制之后输入标签 到达没有执行任何操作,您的页面 保留原始标题和类型.

You can update the attributes of your page by updating your page's tags. Note that og:title and og:type are only editable initially - after your page receives 50 likes the title becomes fixed, and after your page receives 10,000 likes the type becomes fixed. These properties are fixed to avoid surprising users who have liked the page already. Changing the title or type tags after these limits are reached does nothing, your page retains the original title and type.

来源 .

但是,如果您确实需要更改title,并且可以确定可能失去喜欢的人数,那么可以在末尾添加一个假参数元标记的标签,以便Facebook 认为是一个新页面:

BUT if you really need to change the title and you are okay of probably losing the likes' count, then you can add a fake parameter to the end of the URL meta tag so that Facebook thinks it's a new page:

http://www.domain.com/page.php?123

请注意,我从未在新的Like插件中使用过此技术.

这篇关于&amp; lt; fb:like&amp; gt;的问题页面标题,如计数和页面网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆