Custom share icons
Add in custom share links
If your anything like me you will have been asked or wanted to add share icons to your site or clients site / app. But the designers have proposed custom icons so adding in the default social share icons will make the design look crap or your haven’t managed to convince them that the default functionality is actually ok. Having said that the default look is ugly. So what to do? I have used this method in production and all has went well. Here is the code and a simple explanation.
How it works
You start by building up a url using the relevant url for each of the share services. So for example twitter url is https://twitter.com/intent/tweet?status= then you get the the document page title using this js:
This js gets the page title
This gets the link of the current page. The after you have the page title, the page url you can also get some other bits you may want to build up the url. Such as an image or a message.
I used data attributes to get these as required.