I am using Drupal for running a website. I have integrated the "Share bar" module to share the current page in social networking sites. I know from the plugins code of Facebook that the share count of the website is 200+ But the share bar module shows only 20+ count.

enter image description here

I could find out what the problem is, the code for sharebar is:

<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/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> <html xmlns:fb="http://ogp.me/ns/fb#"> <fb:like href="[url]" send="true" layout="box_count" width="450" show_faces="true"></fb:like>

In the code above, [url] token actually gives out http://www.indiansnakes.org/frontpage instead of http://www.indiansnakes.org. I think the [url] token refers to hyperlink before redirection is completed.

How can I modify the script above so that I get the count for www.indiansnakes.org instead of www.indiansnakes.org/frontpage

4 Answers 4


Looking at the source code on your live site, I see that the code for the fb:like section becomes:

<fb:like href="http://indiansnakes.org/frontpage" send="true" layout="box_count" width="450" show_faces="true"></fb:like>

...so I assume [url] is a token. Assuming that's true, I'd recommend using a more specific URL token.

  • Good suggestion, but none of the URL tokens above helped me. I tried: [url:absolute], [url:alias], [url:path], [url:relative]. Mar 28, 2014 at 8:33
  • I assume you use this on other pages on the site to link directly to them as well? Because if not, you could just hardcode the URL. (Also, I suppose even if you do, you could disable the token-generated version on the home page and use a hardcoded version there.) Mar 28, 2014 at 13:36
  • Hardcoding URL won't help me, [url] is fine for all other pages in my website except for home page. In case of homepage it appends a '/frontpage' which is needed by Drupal. Mar 31, 2014 at 16:43

Create a custom 301 re-direct rule in your .htaccess file.

After the Rewritebase / (line 110) in .htaccess, copy and paste the following...

  #custom redirects
RewriteRule ^frontpage$ http://www.indiansnakes.org [R=301,L]
  #end custom redirects

This is worth doing whenever you set another node as your default front page to stop any duplicate content issues. Especially when using site map generators that will list both www.indiansnakes.org and www.indiansnakes.org/frontpage automatically in a site map.

Also, try flushing the cache afterwards to make sure ShareBar refreshes.


This re-directed the page correctly, but it didn't update the sharebar app. Looking at source and searching "frontpage" brings up 41 occurrences, and some of them are where the pages canonical url is used. Consider installing the metatag module, and manually setting your front page canonical url as http://www.indiansnakes.org in the metatag module settings for the front page

  • Good suggestion about 301 redirection for SEO and to resolve duplicates. Performed the suggested changes, but unfortunately the share count is not updated. I think it still refers to 'indiansnakes.org/frontpage' rather than 'indiansnakes.org' Mar 31, 2014 at 19:21
  • 1
    Yes it is, just looked at your source and fb, google and twitter are all still using the /frontpage. I would try disabling and re-enabling it. Please see my updated answer above. I normally use the Share This module, its pretty good. Also, there are a few errors in dev tools, one is that you are still loading socket.io.js from a localhost src.
    – Collins
    Mar 31, 2014 at 22:41

You can install Global Redirect module, which I would strongly recommend for SEO.

Once enabled, an alias provides a nice clean URL for a path on a site. However Drupal does not remove the old path (eg node/1234). The problem is that you now have two URLs representing the same content. This is dangerous territory for duplicate pages which can get you sandboxed by the search engines!

This module can also solve your problem with 2 URL's for frontpage: www.example.com and www.example.com/frontpage

Checks if the current URL is the same as the site_frontpage and redirects to the frontpage if there is a match.


I'd assume the ShareBar module isn't very good at resolving Drupal's front page setting, and/or supporting tokens.

In fact, here's an issue for ShareBar dealing with tokens: https://drupal.org/node/2106887 It doesn't appear to have much traction after being posted in late 2013. You might try seeing if you can apply the patch, reviewing it, and/or setting the issue to RTBC.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.