Tweet button suddenly mangling CafePress URLs


All of a sudden my Tweet buttons are mangling URLs in my CafePress shops. Note that these buttons have been up for anywhere from weeks to months and were working perfectly until, I think, yesterday. Also note that the EXACT same code works correctly on other sites, such as Blogger and my own web sites.

The basic code I use looks like this:

<a href="" class="twitter-share-button" data-text="MY_TEXT" data-size="large" data-count="none" data-hashtags="COMMA_SEPARATED_HASHTAGS">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);;js.src="//";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>

Here’s an actual sample:

<a href="" class="twitter-share-button" data-text="#Linux user since #1991" data-size="large" data-count="none" data-hashtags="OpenSource,OperatingSystems,geeks,OS,AntiWindows">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);;js.src="//";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>

which you can see in action on this page:

Selecting the Tweet button now yields this:

#Linux user since #1991 #OpenSource #OperatingSystems #geeks #OS #AntiWindows</code>

Note the incorrect URL, <b></b> with the double <b></b> instead of the correct <b></b>.

I stuck this exact same code on a page on my web site so you can see that it works correctly there; please go here and scroll down to <b>CORRECT HERE, NOT CORRECT ON CAFEPRESS</b> and try its Tweet button. Again, it's the EXACT same code, but it works correctly everywhere except CafePress.

Since I've changed nothing, and all of these buttons worked correctly before, and work fine everywhere but CafePress, I'm at a complete loss how to fix the problem, or who to contact. Is there something bugzilla-like for Twitter?


It appears you have some invalid markup on your pages:

The HREF value here is not a valid URI – you probably want:


I don’t know where you’re seeing that (because I haven’t looked yet), but the Tweet button code is exactly the same as it’s always been–and was working correctly–and does not have a URL hardcoded into it, so that can’t be where you’re seeing it. Again, this exact same Tweet button code works correctly EVERYWHERE except on CafePress as of yesterday.

Now I’m off to look at the page source to see where you’re seeing the snippet you quoted…

…and I’m back. That snippet is outside my control–it’s generated by CafePress–but I’m guessing it’s the culprit here. I’m off to bug report this to CafePress.

Thanks for the heads-up. I was thinking strictly in terms of Twitter having suddenly gone berserk…although it didn’t make sense that it was only on CafePress that the wonked version showed up!


UPDATE: Okay, I bug reported the above to CafePress, and although I haven’t received a response from them yet, they’re clearly working on it.

Earlier this morning I tried some of my Tweet buttons, and although they still weren’t creating the correct URL, at least the double “” was gone. So instead of yesterday’s result:
I was now getting:
– definitely an improvement, but still not correct, as it should be

When I checked some of the pages’ source, this:

had been changed to this:

But, again, note that that did NOT result in a correctly created URL for the Tweet button…so I don’t know what to think.

Right now, it’s back to the incorrect

so, as I said, they’re WORKING on it. I just hope they FIX it. Soon. The thought of going through thousands of pages and changing the code I use [to include hardcoded URLs] is too daunting to even imagine…


The update I posted this morning still hasn’t been published, but I’m posting another update anyway.

I was less than thrilled with the response I got from CafePress:

"Thank you for contacting and bringing this to my attention. I’d be happy to help you with this but does not offer any support for custom HTML you have added to your shopfront.

Please review the links and coding you are using to determine what may be missing, or if the requirements and specifications for Tweeting a link have changed.

I apologize for the trouble, but if there is anything else I can do for you, please let me know."

I replied with:

"Thanks for the reply, but you’re missing the point. And I KNEW you would, which
is why I said ‘PLEASE do not tell me CP isn’t at fault here. The fact that the
EXACT SAME CODE worked up until approximately yesterday AND works everywhere other than CP suggests otherwise!’

CP HAS changed something, and as a result the Twitter code–which worked FINE on CP up until two days ago, and works FINE EVERYWHERE else–cannot create correct URLs.

I know that CP is working on it, because my pages’ source code has changed
throughout the morning, sometimes having the incorrect:

and other times having the correct:

Why is someone changing that if there’s no issue with it? confused

Anyway, the fact that CP doesn’t offer support for custom HTML has nothing to do with my problem, since the problem is ORIGINATING at CP."

So, knowing that they’re basically saying ‘screw you,’ and having no idea if/when they’re going to put things back the way they were–or if they’ll change things again at a later date that will mangle URLs–I’ve started on the DAUNTING task of hardcoding URLs into the Tweet button codes in my CafePress shops…the THOUSANDS of pages I have that contain Tweet buttons…


You can partially mitigate the whims of your provider by providing explicit URLs to the Tweet Button invocation wherever you have the button – which looking at your site looks like you’re now doing?


Yes, as I said in my later update, I’m hardcoding the URLs now. In the end, that’s probably going to turn out to be a good thing, because I have no control over, or knowledge of, changes CafePress may make at their end. But I have multiple CafePress shops, including my original, BIGGEST one at – and between them there are thousands of pages that have Tweet buttons. Right now my head is about to explode at the prospect!

At one point yesterday, when I was checking periodically to see if the original code was working again, the URLs created had this form:

I was like, WTF?! Canada? How’d I end up in Canada?! And, yes, the source showed this:

So, like I said, CafePress was/is clearly WORKING on it, but they’re still not getting it right!

closed #8

closed #9