I have a page with tens or hundreds of posts, each one with social buttons. I just can't generate all the buttons for each url: it is too slow (facebook, g+, twitter, pinterest... for hundreds of links). So, instead of the facebook share button to be generated on the fly, I use a simple img pointing to
https://www.facebook.com/sharer.php?u=${url_of_current_post}&t=
When the user clicks on it, a popup window opens with content generated by facebook.
How can I do it for Pinterest? I only find around code to generate the button, but I would like to avoid js at all if possible. Is there something like the following?
http://pinterest.com/pinthis?url=${url_of_current_post}
Please do not try to make me use the js button, thanks.
I Found some code for wordpress:
Then you put the following in your PHP:
The standard Pinterest button code (which you can generate here), is an
<a>
tag wrapping an<img>
of the Pinterest button.If you don't include the
pinit.js
script on your page, this<a>
tag will work "as-is". You could improve the experience by registering your own click handler on these tags that opens a new window with appropriate dimensions, or at least addingtarget="_blank"
to the tag to make it open clicks in a new window.The tag syntax would look like:
If using the JavaScript versions of sharing buttons are ruining your page load times, you can improve your site by using asynchronous loading methods. For an example of doing this with the Pinterest button, check out my GitHub Pinterest button project with an improved HTML5 syntax.
For such cases, I found very useful the Share Link Generator, it helps creating Facebook, Google+, Twitter, Pinterest, LinkedIn share buttons.
You can create a custom link as described here using a small jQuery script
this will work for all links with class
linkPinIt
which have the image and the description stored in the HTML 5 data attributesdata-image
anddata-desc
see this jfiddle example
I had the same question. This works great in Wordpress!
So you want the code to the pin it button without installing the button? If so just paste this code in the place of the url of the page you're pinning from. It should function as a pin it button without the button.
javascript:void((function(){var%20e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('charset','UTF-8');e.setAttribute('src','http://assets.pinterest.com/js/pinmarklet.js?r='+Math.random()*99999999);document.body.appendChild(e)})());