facebook xid doesn't work

陌路散爱 提交于 2019-12-22 01:09:43

问题


i need separate comment thread for each post on my website, so i followed instructions at http://developers.facebook.com/blog/post/472, ie i inserted the code:

 <div id="fb-root"></div>
 <script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
 <fb:comments href="www.mysite.com" xid="postPOST_ID_HERE"></fb:comments>

under each post.

but it doesn't work and there is SAME comments thread under each post.

if i try this code:

 <div id="fb-root"></div>
 <script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
 <fb:comments href="http://www.mysite.com/news.php?id=POST_ID_HERE"></fb:comments>

it seems to work, ie i get separate comment thread per post. but according to facebook instructions href parameter needs to be canonical url. am i doing something wrong in the first case or is the second example way to go (even if against facebook manual)?


回答1:


I don't think you need to use both the href and the xid variables. I think the href variable is the newer version according to Facebook Developer Blog this is the new code:

<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<fb:comments href="YOUR_CANONICAL_URL"></fb:comments>

It also says "If you already have the original Comments Box installed, include the parameter migrated="1" to keep existing comments" and shows this as an example:

<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<fb:comments xid="YOUR_XID" migrated="1"></fb:comments>

I am using the first version I posted here, but using addresses like you mentioned, and it works. So I'd say go with the second version even if it goes slightly against what they say. It works properly for me.




回答2:


Plugin doesn't work on my 2 sites on different servers from yesterday, but on http://www.vesti.ru/doc.html?id=442871 plugin works normally



来源:https://stackoverflow.com/questions/5557175/facebook-xid-doesnt-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!