Reputation: 11
Since yesterday when Pinterest updated its website, my Pinterest 'Pin it' buttons stopped functioning properly, i.e. the spinning wheel goes forever in the popup window.
My code - which used to work fine - is:
<a data-pin-config="beside" href="//pinterest.com/pin/create/button/?url=<?=urlencode($url)?>&media=<?=urlencode($image_url) ?>&description=The picture I just pinned!" data-pin-do="buttonPin" >
<img src="//assets.pinterest.com/images/pidgets/pin_it_button.png" />
</a>
I also include the Pinterest js just before the </body>
closing tag.
What is interesting is that when I go on Pinterest's website and try to Add Pin
by URL, I get:
"Whoops! Invalid URL"
My $url refers to php pages which pass several parameters, i.e.
http://www.mywebsite.com/img.php?img_id=photo (999).jpg&album=...&page=...
Update #1: I noticed that when the posted URL does not contain any parentheses, there is no problem posting on Pinterest directly or via the buttons. Although the URLs are all urlencoded in php, i.e. the ( and ) are encoded to %28 and %29 respectively, which should be taking care of the parentheses, it does not seem to work. The browser still shows the parentheses although I realize that it is interpreting the url encoded %28 and %29 codes.
Update #2: Received reply from Pinterest saying
"Sometimes we see this behavior if a website is blocking Amazon IPs. Make sure you're not blocking Amazon IPs or whitelist our user agent:
Pinterest/0.1 +http://pinterest.com/
Unfortunately, we don't have a dedicated group of IPs that you could whitelist because our IPs change over time."
Following Pinterest's reply, I did my research and came up with the following relevant links:
http://wordpress.org/support/topic/note-when-entering-user-agent-whitelist
"Pinterest have to be whitelisted as a referrer or agent so that it will see the image - if not it will just see the redirect to a HTML page (thus "not a valid image"). Try to put pinterest and pinterest.com on your user agent whitelist"
Questions:
Has this worked for anyone?
What's the best way to modify .htaccess or robots.txt to accomplish that?
I am facing the same issue with Tumblr as well. I have verified that w/o the parentheses, the share it button works fine. If nothing else works, should I remove all the parentheses from the URIs?
Upvotes: 1
Views: 12223
Reputation: 11
Problem solved!
It was not the parentheses that were causing the failure to pin (or share on Tumblr), but the spaces in the URL (in my case the space before the parenthesis). Although the spaces were URL encoded (+), Pinterest was viewing it as an invalid URL.
I removed all spaces from the picture file names, which means also from the URL since the URL passes as a parameter the picture filename.
This fixed the issues for both the Pinterest and Tumblr buttons.
Upvotes: 1