Twitter button generates wrong URL


#1

Hi there,
our Twitter buttons sometimes fails to generate a correct URL. Instead of linking to the correct article, a URL is generated to the front page. An example can be seen in this[1] article. What is confusing to us is that it seems to know the correct URL (it is added as “original_referer”), yet the “url” is wrong.

[1] http://www.dagbladet.no/2011/11/28/kultur/litteratur/bok/anmeldelser/litteraturanmeldelser/19198255/


#2

Hm, looks like you have a <link rel=“canonical” href="" /> element in pages which detect the link incorrectly. In pages which do detect the link, the href attribute is correctly populated. If no data-url is specified in the Tweet button, the Twitter script looks at the link rel canonical element to find the “official” URL of the page.


#3

Looks like you nailed it, many thanks!


#4

#5