Skip to main content

Add Random Posts Widget for Blogger Blog (Auto Updated & Fast Loading)

If you are looking for a fast loading and auto updated Random Posts Widget for Blogger, this SEO-friendly code is the perfect solution for your website. This widget automatically fetches the latest posts from your blog feed and displays 7 random posts every time the page refreshes.

It improves internal linking, user engagement, and page views, which are important factors for better search engine ranking. The widget is lightweight, clean, mobile responsive, and fully compatible with Blogger.

With this SEO optimized 7 Random Posts Widget, your visitors can easily discover more content on your website, reducing bounce rate and increasing overall traffic. Simply add the HTML and JavaScript code to your Blogger layout and your blog will automatically show fresh random posts without any manual updates.

Random Posts Widgets HTML Javascript Code 

<!-- Ultra Fast 7 Random Posts Widget -->

<div id="rp-box" style="padding:16px;background:#ffffff;border-radius:14px;box-shadow:0 4px 10px rgba(0,0,0,0.05);margin:15px 0;">

<h2 style="font-size:18px;margin-bottom:12px;color:#202124;font-weight:600;">
🔥 Recommended Posts
</h2>

<ul id="rp-list" style="list-style:none;padding:0;margin:0;font-size:14px;line-height:1.8;">
<li>Loading...</li>
</ul>

</div>

<script>
(function(){
fetch("https://www.gayuddy.com/feeds/posts/default?alt=json&max-results=40")
.then(function(res){ return res.json(); })
.then(function(data){

var posts = data.feed.entry || [];
var list = document.getElementById("rp-list");
list.innerHTML = "";

posts.sort(function(){ return 0.5 - Math.random(); });

for(var i=0; i<7 && i<posts.length; i++){

var post = posts[i];
var title = post.title.$t;
var link = "";

for(var j=0; j<post.link.length; j++){
if(post.link[j].rel === "alternate"){
link = post.link[j].href;
break;
}
}

list.innerHTML +=
'<li style="margin-bottom:8px;">' +
'➤ <a href="'+link+'" style="text-decoration:none;color:#1a0dab;font-weight:500;" title="'+title+'">' +
title +
'</a></li>';
}

})
.catch(function(){
document.getElementById("rp-list").innerHTML =
"<li>Posts not available.</li>";
});
})();
</script>
<!-- End Widget -->


What changes can you make in this?

Post Count: for(var i=0; i<7 && i<posts.length; i++)

Feed Limit: max-results=40

Link Colour: color:#1a0dab;

Heading: 🔥 Recommended Posts

Bullet Icon: ➤

Border/ Shadow: box-shadow:0 4px 10px rgba(0,0,0,0.05);

Background: #111;
color:#fff;


Where to Add the 7 Random Posts Widget Code in Blogger ?

You can add the widget in different places depending on where you want it to appear.

Add in Sidebar (Best & Recommended)

  1. Go to Blogger Dashboard
  2. Click on Layout
  3. In the Sidebar section, click Add a Gadget
  4. Choose HTML/JavaScript
  5. Paste the full widget code
  6. Click Save

Now the widget will appear on all pages (homepage and posts) in the sidebar.

Show Below Every Post (Best for Engagement)

If you want the 7 random posts to appear below every blog post:

  1. Go to Theme
  2. Click Edit HTML
  3. Press Ctrl + F and search for:
</body>
  1. Paste the widget code just above </body>
  2. Click Save

Important: Paste the code only once.

Comments