简体   繁体   English

我可以在不同页面上使用相同的Facebook评论框吗?

[英]Can I use the same Facebook comments box on different pages?

We are using the latest HTML5 Facebook comments plugin on a news site. 我们正在新闻网站上使用最新的HTML5 Facebook评论插件。 On this site, a news story can appear/be slotted in multiple news sections and thus have multiple unique url's even though it's the identical story. 在此站点上,新闻故事可以出现在多个新闻部分中/放在其中,因此即使是相同的故事,也可以具有多个唯一的URL。 With that in mind, I was wondering if it's possible for the same comments box/comments to show up on each of the unique url's for the same story. 考虑到这一点,我想知道是否有可能在相同故事的每个唯一URL上都显示相同的注释框/注释。

From my research, most people are suggesting the data-href attribute has to be the url of the current page. 根据我的研究,大多数人建议data-href属性必须是当前页面的url。 I'm just wondering though if I can insert the url of just one of the story's slotted instances in the data-url attribute on each identical story instance/page, rather than the url of the current page where the comments box is currently being rendered. 我只是在想,是否可以在每个相同的故事实例/页面的data-url属性中插入故事的某个带槽实例的网址,而不是插入当前正在显示注释框的当前页面的网址。 If the data-href value has to be the url of the current page, I'm wondering why this attribute is even needed. 如果data-href值必须是当前页面的url,我想知道为什么甚至需要此属性。 Wouldn't the FB api just pull the current page url from the location.href? FB api不会只是从location.href中提取当前页面的url吗?

I don't know the answer conclusively, however the Facebook Developer documentation says the following about the href parameter "href - the URL for this Comments plugin. News feed stories on Facebook will link to this URL.", which seems to indicate that the parameter has less to do with the box's functionality and more to do with the URL that Facebook will link to when comments are added. 我无法完全确定答案,但是Facebook开发人员文档对href参数“ href-此Comments插件的URL。Facebook上的新闻提要故事将链接到此URL”说以下内容。参数与框的功能无关,而与添加注释时Facebook将链接到的URL有关。

I know we are working on a solution right now that uses the same Like button for URL variations representing search query results on a main blog page result list of posts. 我知道我们正在开发一种解决方案,该解决方案使用相同的“赞”按钮进行URL变体表示博客主页面结果列表中的搜索查询结果。 The URL changes based on the query/results, but the same Like button should always "Like" the default URL for the main blog page. URL根据查询/结果而变化,但是相同的“赞”按钮应始终“赞”博客主页面的默认URL。 So far, this appears to be working. 到目前为止,这似乎正在起作用。

You could try it and use the Debugger Tool to see if you get any errors when using a URL for the href parameter that is different from the actual URL of the page. 您可以尝试使用调试器工具来查看将href参数使用的URL与页面的实际URL不同时是否遇到任何错误。

One final note, which may already be accounting for, is that Google doesn't like different URLs with duplicated content. 最后一点可能已经引起了人们的注意,那就是Google不喜欢内容重复的不同URL。 You will need to declare a preferred/canonical URL to avoid trouble with Google, and you should probably use the same preferred URL for the Comments href. 您需要声明一个首选/规范的URL以避免与Google发生麻烦,并且您可能应该对Comments href使用相同的首选URL。

http://support.google.com/webmasters/bin/answer.py?hl=en&answer=66359 http://support.google.com/webmasters/bin/answer.py?hl=zh_CN&answer=66359

Try This: 尝试这个:

< div class="fb-comments" expr.href='data:post.url' data-width="600" data-numposts="5" data-colorscheme="light"> <div class =“ fb-comments” expr.href ='data:post.url'data-width =“ 600” data-numposts =“ 5” data-colorscheme =“ light”>

NOte: 注意:

in the above line in between < and div there is no space. 在以上<和div之间的行中,没有空格。

paste this code just above to 将此代码粘贴到上方

class='post-footer-line post-footer-line-3 class ='post-footer-line post-footer-line-3

Check in: http://debaonline4u.blogspot.com 签到: http : //debaonline4u.blogspot.com

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM