Adding LinkedIn Share Support to Octopress
Last Updated: Jul 15, 2014
I was looking for a plugin or an include to easily add LinkedIn support to the share options for my posts.
A quick Google search came up dry, so I figured I’d just roll my own.
In order to accomplish this, all that is required is to edit source/_includes/post/sharing.html
:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
The change above adds a snippit of Javascript that passes the current site.url
and page.url
in a similar fashion as is done for Twitter.
The Javascript source was generated using LinkedIn’s Share Plugin Generator, so if the format of the one I’ve chosen isn’t to your liking, you can generate another.
Just in case you want to easily toggle this functionality, I’ve also set it up to check for a configuration value in your site’s _config.yml
:
1 2 3 4 5 6 7 8 9 10 |
|
Now, the next time your site is regenerated, a LinkedIn share button will be available.
This same method could be used to add pretty much any other social sharing sites you may want, as most should provide some form of widget generator.