Search code examples
htmlpinterest

Hashtag in pinterest share description


I'm trying to set up social sharing with pinterest on my page. It works fine, except hashtags don't seem to show up.

I quickly threw together a jsfiddle with my code. As you can see I put a hashtag in the description, but when the box pops up for sharing it omits the tag altogether.

<a onclick="return !window.open(this.href, 'Share on Pinterest', 'width=640, height=536')" 
href="http://pinterest.com/pin/create/button/?
url=http://google.com&media=http://dummyimage.com/600x400/000/fff&description=this is a #hashtag" 
class="pin-it-button" count-layout="horizontal"> 
<img src="https://cdn.shopify.com/s/files/1/0636/3475/files/pinterest_e8e717fe-0b0d-4a38-8290-5c5beb871dd4.png?9971" width=22/></a>

Does anyone know how I can put a hashtag in the description and have it work? I tried using

Thanks for any help!


Solution

  • You need to encode the # for URL - replace it with %23 and you'll get your desired result - Fiddle

    <a onclick="return !window.open(this.href, 'Share on Pinterest', 'width=640, height=536')" href="http://pinterest.com/pin/create/button/?url=http://google.com&media=http://dummyimage.com/600x400/000/fff&description=this is a %23hashtag" class="pin-it-button" count-layout="horizontal">
       <img src="https://cdn.shopify.com/s/files/1/0636/3475/files/pinterest_e8e717fe-0b0d-4a38-8290-5c5beb871dd4.png?9971" width=22/>
    </a>