简体   繁体   中英

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

We are using the latest HTML5 Facebook comments plugin on a news site. 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. 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.

From my research, most people are suggesting the data-href attribute has to be the url of the current page. 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. If the data-href value has to be the url of the current page, I'm wondering why this attribute is even needed. Wouldn't the FB api just pull the current page url from the location.href?

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.

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. The URL changes based on the query/results, but the same Like button should always "Like" the default URL for the main blog page. 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.

One final note, which may already be accounting for, is that Google doesn't like different URLs with duplicated content. 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.

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

Try This:

< 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.

paste this code just above to

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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