You are here: Home / Documentation / How To's / How to add Pinterest button to document actions

How to add Pinterest button to document actions

by ledwell published Mar 19, 2012 01:16 PM, last modified Aug 16, 2016 10:50 AM
Add the social media "pinterest" button inside a document action.

Im not really a pinterest user but I was asked to figure out how to add a pinterest link to the "document actions". The link needed to behave just like when you choose the pinterest link on your browsers bookmarks bar. (assuming you placed the "pin it" button there). When you choose that bookmark it pops up a list of eligible images on your site (shown below) and allows you to add them to your board.

pinterestExample

This is pretty easy to do. You can't find the javascript on their website or any directions to add the functionality assigned to the pinterest "bookmark". I pretty much just grabbed the code from the bookmarklet. Since the javascript is pointed at their servers if something changes on their end be aware it will effect your site as well.

Take care of the icon

  • Go to pinterests website and save the button icon you want to see on your website to your desktop.http://pinterest.com/about/goodies/
  • Login to your website
  • go to the ZMI
  • navigato to: manage - portal_skins - custom
  • Upload that icon as an image to the custom folder

Deal with the code

  • go to "portal-actions" - "document-actions"
  • choose "add CMF" action
  • Title should be "Pinterest" (or what ever you want your users seeing
  • URL (Expression) should be
string:javascript:void((function()%7Bvar%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)%7D)());
  • Icon (Expression) should be
string:$portal_url/pinterest-button.png
  • Permissions should be set to "view"
  • Visible should be "Checked"
 
Navigation