0

I have 2 versions of my website Mobile and Desktop with Facebook Comment Plugin embedded in it. I want to sync every comment between the 2 websites having same address except for the subdomain like

https://www.example.com/contact-us.php
https://m.example.com/contact-us.php

I read about Comment Mirroring at Facebook Comments - Synchronization between website and fan page but I don't think this is what I want.

I want to enable my visitors to comment and see same comments on both these versions. Is it possible or not? I mean if someone comment on desktop version website then the comment should be visible on mobile version as well.

I have this code provided by Facebook when embedding Comment Plugin. Where do I have to change to support comment sync

 <div id="fb-root"></div>
 <script>(function(d, s, id) {
 var js, fjs = d.getElementsByTagName(s)[0];
 if (d.getElementById(id)) return;
 js = d.createElement(s); js.id = id;
 js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.6&appId=XXXXXXXXXXXXXXXX";
 fjs.parentNode.insertBefore(js, fjs);
 }(document, \'script\', \'facebook-jssdk\'));</script>

And this code on the page I want to show comment block

 <div class="fb-comments" data-href="https://www.example.com/contact-us.php" data-width="950" data-numposts="5"></div>
Airy
  • 5,484
  • 7
  • 53
  • 78

1 Answers1

1

The comments made via the comments plugin are not tied to the page that you embed the plugin on, but to the URL you specify in the data-href parameter.

So if you want to have the same comments on the desktop and the mobile version of your site - specify one of those URLs as data-href for both versions.


Also, you should use the same og:url value for both versions; otherwise, like and share counts will get split over those two distinct URLs.

CBroe
  • 91,630
  • 14
  • 92
  • 150
  • Although I solved my problem just like you said by keeping the same URL but yet I could not get what is og:url? where it is? – Airy Jul 14 '17 at 07:30
  • Part of the [Open Graph meta tags](https://developers.facebook.com/docs/sharing/webmasters#markup); it is used to tell Facebook what the “real” URL for a piece of content is supposed to be. If you don’t specify it, or specify different URLs for the mobile and the desktop version, then Facebook will count likes and shares separately for those two. – CBroe Jul 14 '17 at 07:53
  • 1
    Thanks CBroe! I have accepted your answer and rewarded you my bounty. Thanks for your kind help. – Airy Jul 15 '17 at 07:50