Text only Pinterest link

As I’ve said a few times before, I prefer to keep control over the look of the social links that appear on this site. I also prefer to keep control over the source code and have an almost religious fervor against the iframed code bloat most social buttons produce.

So when it came time to add a Pinterest link to the share section, I again went in search of a text-only link. Stack Overflow had a couple of leads which ultimately didn’t work. It was easy enough to get a link to a ‘add pin’ window, but the solutions required that a specific url to an image be added. Pinterest’s ability to scan a page and show all pinnable images was missing.

I eventually came across Jeremy Mansfield’s post: Add a Custom Pinterest Button to your Website (Part 2), which does a great job explaining the crux of the issue, as well as a solid, well thought out solution by Cameron Clark.

I gave Cameron’s solution a try, and can confirm that it did indeed work. I ultimately decided to go the route below for a couple of reasons: 1. I wanted something a bit simpler, that didn’t require another enqueue_script, and 2. This solution shrank the sizes of the images that get pinned and I preferred them at full size.

The final solution I arrived at was to take the Pinterest Bookmarklet and extract the javascript into a text-based link on the site:

<a href='javascript:void((function(d)%7Bvar%20e%3Dd.createElement(%27script%27)%3Be.setAttribute(%27type%27,%27text/javascript%27)%3Be.setAttribute(%27charset%27,%27UTF-8%27)%3Be.setAttribute(%27src%27,%27//assets.pinterest.com/js/pinmarklet.js%3Fr%3D%27%2BMath.random()*99999999)%3Bd.body.appendChild(e)%7D)(document))%3B'><i class="icon-pinterest"></i></a>

As you’ll notice on this site, icon-fonts are used instead of text for these links, but you get the idea.

You’ll also notice the Pinterest icon is missing in the share section below. That’s because I conditionally show it only on Image posts. You can see it in action here.

19 thoughts on “Text only Pinterest link

  1. Excellent beat ! I wish to apprentice while you amend your
    website, how could i subscribe for a blog web site?
    The account helped me a acceptable deal. I had been
    tiny bit acquainted of this your broadcast provided bright clear idea

  2. The Paleo Diet is not presented as just a diet, but as a lifestyle choice.
    Hunting animals and gathering produce from the earth was
    the norm. Always check your physician before making any changes to your
    daily habits.

  3. Nice post. I learn something new and challenging on websites I stumbleupon every day.

    It will always be helpful to read content from other
    authors and practice a little something from other websites.

  4. These ingredients may not lead to weight loss individually, but they can be quite
    effective when used in combination. Likewise, double or triple dosing on something is not going to
    give you faster results and in some cases it
    can cause paranoia, sweating and dehydration, heart palpitations, restlessness and severe muscle cramping.
    Research states that some supplements are really effective for weight loss but consulting
    the doctor is still the best move prior to ttaking any supplements.

  5. Have you ever thought about adding a little
    bit more than just your articles? I mean, what you say is fundamental and all.

    Nevertheless just imagine if you added some great visuals or video clips to give your
    posts more, \”pop\”! Your content is excellent but with images and video clips, this site could definitely be one of the most beneficial in its niche.
    Great blog!

  6. It\’s actually a great and useful piece of info.
    I\’m happy that you simply shared this helpful info with us.
    Please stay us informed like this. Thanks for sharing.

  7. Have you ever considered writing an ebook or guest authoring on other sites?
    I have a blog based upon on the same information you discuss and would
    love to have you share some stories/information.
    I know my subscribers would value your work. If you
    are even remotely interested, feel free to send me an email.

  8. Very shortly this web page will be famous among all blogging
    and site-building people, due to it’s good content

  9. Having a contemporary kitchen design will imply that you will spend money on the most stylish kitchen equipments and appliances.
    With a nicely matching rustic kitchen design that coordinates your cabinets with everything else, your kitchen
    will immediately become your family’s favorite room within the house.
    Today kitchens less complicated more dynamic environments to begin with, plus many homes they’re about the
    most used room in the house.

  10. I like what you guys tend to be up too. This kind of clever work
    and reporting! Keep up the terrific works guys I\’ve added you guys
    to blogroll.

  11. Greetings, I believe your website might be having web browser compatibility problems.
    Whenever I take a look at your site in Safari, it looks fine but when
    opening in Internet Explorer, it has some overlapping issues.
    I simply wanted to give you a quick heads up! Other than that, excellent blog!

  12. I\’ve been exploring for a bit for any high quality articles or weblog posts on this kind of space .
    Exploring in Yahoo I at last stumbled upon this website.
    Studying this information So i am happy to exhibit that
    I have a very just right uncanny feeling I came upon just what I needed.
    I most without a doubt will make sure to don?t
    disregard this web site and provides it a glance regularly.

Leave a Reply

Your email address will not be published. Required fields are marked *

Ready for a refreshing experience on your next website design?