简体   繁体   中英

Facebook comments plugin, URL aliases?

I'm using Facebook comments plugin to display a comment area in each of my product pages ( http://mydomain/product/:productid ).

<div class="fb-comments"  data-href="http://mydomain/product/1" data-order-by="social" data-width="100%" data-numposts="5" data-colorscheme="light"></div>

This works great, except that each of those comment area are "instantiated" by url. Facebook knows how to retrieve each pages comments thanks to the provided URL.

Problem is, i have subdomains like http://dev.mydomain/product/1 or http://alpha.mydomain/product/1 and i would like to retrieve the comments left on http://mydomain/product/1 on those subdomains.

So, is there any way to declare "aliases" to http://mydomain/product/1 , in order to retrieve the same comments on http://dev.mydomain/product/1 or http://alpha.mydomain/product/1 ?

Edit : Still stuck here, http://alpha.mydomain.com and http://www.alpha.mydomain.com have two different comments container, because urls are not the same...

Are you able to use JS to make a call to their Graph API? You can get the comments for a URL by making a GET call to their API:

https://graph.facebook.com/v2.6/?fields=og_object{comments}&id=<YOUR_URL>&access_token=<YOUR_TOKEN>

Facebook stores and retrieves comments based on the full URL, but you could try passing the same URL to the Facebook javascript; that might give you what you want. Let me know what happens.

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