Last active
December 10, 2015 18:49
-
-
Save mrcave/4477511 to your computer and use it in GitHub Desktop.
The ultimate guide to socializing your LightCMS website
http://lightignite.com/the-ultimate-guide-to-socializing-your-lightcms-website
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> | |
<script type="text/javascript" src="/js/jquery.share-this-blog-list.js"></script> | |
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function(){ | |
//Run through the page and find each individual blog post | |
$(".blogList li").each(function () { | |
//Grab post title & encode any quotes so they don't mess up generated HTML | |
var $postTitle = $.trim($(this).children(".postTitle").text().replace(/"/g, """)); | |
//Grab URL from the anchor element inside the h2 element (will not grab correct link in admin mode) | |
var $postLink = location.protocol + '//' + location.host + $(this).children("h2").find("a[href]").attr('href'); | |
//Add "share this" HTML elements to the bottom of the post | |
$(this).append( | |
'<div class="st">' + | |
'<span class="st_twitter_button" displayText="Tweet" st_url="' + $postLink + '" st_title="' + $postTitle + '"></span>' + | |
'<span class="st_facebook_button" displayText="Facebook" st_url="' + $postLink + '" st_title="' + $postTitle + '"></span>' + | |
'</div>' | |
); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment