New random post widgets for blogger 2016

How to Add Awesome Simple random post widgets on the blogger : This widget will display a random post or article on a blogger. Meanwhile, random post widgets will showing post randomly, either posting a popular, newest and longest though, in the amount specified in the configuration of the widget. 

Add New random post widgets in blogger

How to Add Simple Random Post in Blogger

Random post Widget with Simple Effect that will be distributed in the article have been adjusted Simply and Looks Good , which Improve Your Blog Pageviews and VIsitors So the blog seem more SEO friendly.

How to install New random post widget in Blogger

Go to Blogger> Layout> Click add gadgets> Search for and add HTML / JavaScript and then copy all of the code in below in the widget> Once added click Save
<style>
scoped='' type="text/css">
#simple-random ul{list-style:none;margin:0;padding:0}#simple-random li{display:block;clear:both;overflow:hidden;list-style:none;border-bottom:4px solid #FE9980;word-break:break-word;padding:10px 0;margin:0;}
#simple-random li:last-child{border-bottom:0;}
#simple-random li a{color:#444;}#simple-random li a:hover{color:#444;text-decoration:underline}</style>
<div id='simple-random'>Loading...</div>
<script>
//<![CDATA[
// Random Post Widget
var homePage = 'http://www.shouterways.com',
    maxResults = 8,
    containerId = 'simple-random';
function getRandomInt(min, max) {
    return Math.floor(Math.random() * (max - min + 1)) + min;
}
function shuffleArray(arr) {
    var i = arr.length, j, temp;
    if (i === 0) return false;
    while (--i) {
        j = Math.floor(Math.random() * (i + 1));
        temp = arr[i];
        arr[i] = arr[j];
        arr[j] = temp;
    }
    return arr;
}
function SimpleRandomPosts(json) {
    var startIndex = getRandomInt(1, (json.feed.openSearch$totalResults.$t - maxResults));
    // console.log('Get the post feed start from ' + startIndex + ' until ' + (startIndex + maxResults));
    document.write('<scr' + 'ipt src="' + homePage + '/feeds/posts/summary?alt=json-in-script&orderby=updated&start-index=' + startIndex + '&max-results=' + maxResults + '&callback=randomPosts"></scr' + 'ipt>');
}
function randomPosts(json) {
    var link, ct = document.getElementById(containerId),
        entry = shuffleArray(json.feed.entry),
        skeleton = "<ul>";
    for (var i = 0, len = entry.length; i < len; i++) {
        for (var j = 0, jen = entry[i].link.length; j < jen; j++) {
            link = (entry[i].link[j].rel == "alternate") ? entry[i].link[j].href : '#';
        }
        skeleton += '<li><a href="' + link + '">' + entry[i].title.$t + '</a></li>';
    }
    ct.innerHTML = skeleton + '</ul>';
}
document.write('<scr' + 'ipt src="' + homePage + '/feeds/posts/summary?alt=json-in-script&max-results=0&callback=SimpleRandomPosts"></scr' + 'ipt>');
//]]>
</script>

Note - Change the number 8 on the code Maxresults = 8; to show how many posts you want. 
Replace Shouterways.com With Your Blog Url .

Save and see the results. 

So Guide of How to Add random post widgets on the blogger is May Useful.

Post a Comment

Previous Post Next Post