Permanent vs aliased urls for tweet counts in Drupal


I’m having issues with my tweet counts staying at zero on a Drupal website.

Since the Twitter Dev site is built on Drupal, maybe a dev can clue me in.

My implementation of the tweet button uses aliased paths for the data-url and node/nodeid for data-counturl. I’m assume that by doing this that one can basically peg tweet counts to permanent url (node/nodeid), and therefore carry over tweet counts whenever a path alias changes.

Unfortunately, this doesn’t seem to work and my tweet count stays at zero. If I change the code to use node/nodeid for data-url and aliased paths for data-counturl then everything seems to work, at least until I change the alias whereby the tweet count resets to zero.

Pegging the shared url to node/nodeid works for all other share buttons except Twitter

Any ideas?

Here’s my code:

  <a href="" class="twitter-share-button" 
    data-url="<?php print url($_GET['q'], array('absolute' => true)); ?>"
    data-counturl="<?php print url($_GET['q'], array('alias' => true, 'absolute' => true)); ?>" 


Could you post a rendered version of the above code?


Sure thing. The above code would render something like this:


The url is the permanently accessible url, and the url is the easy to remember/identify alias which is based on the title of each piece of content.

Since tweets add in the url instead of a title/teaser combo, I’m hoping to be able to use the alias for the tweet content, and then anchor the tweet counts to the permanent url incase we make changes to the title (and therefore alias) later.


Twitter follows the redirects to the final url, so you need to be counting that, a problem I had with my own shortner.


Ah, I see. Thanks for the heads up!


Is this working fine for you now??
I am also on drupal - and below is my code

$l = $base_url . url(“node/” . $node->nid);
$out .= ‘


But my tweet count remains at 0, even though the tweets are happening. what am I doing wrong?


What’s the URL you’re trying to share? If you could provide a rendered view of the above code and an example page where the counter doesn’t increment, it would help.


this is my URL
And the rendered code is as follows:


This is working fine now - without any changes from my end.


I just suscribe here but i dont know what,whats can anyone tell me