If you have applied Facebook comments on Blogger blog and you are not able to see some of the Facebook comments, this post is for you. In this post, we will discuss how to resolve - missing Facebook comments on Blogger sites due to country specific redirection by Blogger.
If you have not yet integrated Facebook comments on Blogger blog, see my previous blog posts below:
- How to add Facebook Comments box on your Blogger blog site?
- How to integrate Facebook comments on single blog post of new Blogger Theme 2017 ?
- How to moderate and get notifications from Facebook Comments on websites or blogs?
Issue with Blogger's country domain redirection with yourblog.blogspot.com (no custom domain)
Now as you may already know, Blogger redirects users to a country specific domain. So the user from India would see .IN in the URL and similarly a user from Brazil would see their own country specific domain in the URL. This causes an issue with Facebook comments as the comments are applied to a specific blog posts URL.
If you have integrated Facebook comments on Blogger site, you might already be aware that Facebook comments made on the Blogger site can be moderated at http://facebook.com/tools/comment as explained in the post How to moderate and get notifications from Facebook Comments on websites or blogs? When we hover on the links on which the comments were made, we might have seen that the URLs are different for the same blog post as well. Because of which an administrator or any one will see some of the Facebook comments and other comments are not visible.
For example:
If some one made comments on the blogger site from India, Facebook comment moderation tool will show that the comment is made on a blog post with .IN in the URL. If some one else views the same blog post from India, he would be able to see the Facebook comment made. But if someone else from Brazil views the same blog post, the particular blog post made by the Indian will not be visible.
How to resolve - Missing Facebook comments on Blogger sites due to country specific redirection
Follow this video to see the missing Facebook comments and how the issue is resolved by forcing Blogger to use .com always.
As described in the video, the ways to resolve the missing Facebook comments in Blogger due to the country specific domain redirection are:-
1) Force Blogger to use .com
One way to resolve this issue of missing Facebook comments is to force Blogger to always use .com in the URL. To do so, apply the following code in Blogger template right after <head> tag and save the theme.
<script type="text/javascript">
/* Get the full URL of the current blogger page */
var blog = document.location.href.toLowerCase();
/* Do not redirect if the domain is .com already */
if (!blog.match(/\.blogspot\.com/)) {
/* Replace the country TLD with .com and ncr switch */
blog = blog.replace(/\.blogspot\..*?\//, ".blogspot.com/ncr/");
/* Redirect to the new .com URL in the current tab */
window.location.replace(blog);
} </script>
Credit: Labnol.org (Source: http://labnol.org/?p=21031)
or this code:
<script type="text/javascript">
var blog = document.location.hostname.split(".");
if (blog[blog.length - 1] != "com") {
var ncr = "http://" + blog[0] + ".blogspot.com/ncr";
window.location.replace(ncr + document.location.pathname);
}
</script>
- Login to Blogger Dashboard
- Click on Theme and backup your theme first
- Then from Theme > click EDIT HTML and paste the code given above after the <head> tag
- Save Theme
- Test by viewing your blog again.
If after updating Blogger theme you find that the page is struggling to open as .com and is going back and forth between the country specific domain and .com, clear the browser cache and try again.
Another way to resolve the issue is to use a custom domain for the Blogger site. That way, the URL of your blog posts will always have the domain in the URL.
- Buy a domain from any domain registrant such a GoDaddy
- Integrate the domain with Blogger in the settings > publishing > Set up a third-party URL for your blog.
- Blogger has custom domain setup instructions here.
Or if you do not want to apply the above code to redirect to .com and still want to see the Facebook comments made on your blog which are not appearing to your because you are being redirected to your country domain, you can still force blogger by using the /ncr prefix after blogspot.com in the URL.
If you would like to see content on other domains and do not want to be automatically redirected, type:
- http://[blogname].blogspot.com/ncr for an entire blog
- http://[blogname].blogspot.com/ncr/examplepage for a single post.
This post concentrated only on the Facebook comments missing in Blogger but the solution discussed will also resolve other issues related to social media tool integrated with Blogger due to the changing URLs with country domain.