Showing posts with label Widgets. Show all posts
Showing posts with label Widgets. Show all posts

How To Add A Clickable Image Banner To Your Blogger Website?

Ever wanted a banner that fits the layout of your website be it on a laptop or android smartphone well you can thank me later as I've got the perfect widget for this occasion.

Step 1: Go to Blogger's layout section and click Add Gadgets 

Step 2: You will have to choose HTML/JavaScript and copy the code provided below

<div style="text-align: center;">
  <a href="https://prsdube16.blogspot.com/p/posts-you-might-like.html?m=1">
    <img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi52nPaphdgFKT0v84OY3OHqF_GZOFI0x1LhDRUg9q_hBpaamr0cQVwAViHms_INuj_eAUXiRLEl0GZlXHTHDhELzZptnPQjLrCuJvcfNxyz-s4Gj07_h1Nm-3X6_rvFe6dE-HWfUauPlEmJJOzbNVnkRuKHQC0tdu6ysWoViWIm_qR4sIdyt4E2_luAGk/s470/IMG_20250718_220318.jpg" alt="Banner Description" class="clickable-banner" style="max-width: 100%; height: auto;" />
  </a>
</div>

Notes
• By <a href> replace the link with the page or site of your choosing
• For <img src> I needed to go to Blogger's posts to get the image link which would require you to upload the image and you'll find a button similar to this one "< >" click it and select html view. Within there select the href that link would make up img src or the component that helps display images.

Advertisement
PASTE ADSENSE CODE HERE

How To Add A Custom Content Banner Widget To Your Blogger Website?

Ever wanted to add a custom banner to your blogger website to display certain places of your site or platforms you're currently subscribed to. Good news, we've got a widget to match your liking as seen above.

Step 1: Go to Blogger's layout section and click Add Gadgets 

Step 2: You will have to choose HTML/JavaScript and copy the code provided below

<div class="custom-banner">
    <div class="banner-content">
        <h3>Explore Our Content!</h3>
        <p>Check out our latest posts and resources.</p>
        <div class="banner-buttons">
<a href="https://prsdube16.blogspot.com/p/posts-you-might-like.html?m=1" class="banner-btn">Cartoon Games</a>
            <a href="https://prsdube16.blogspot.com/p/featured-attractions.html?m=1" class="banner-btn">DStv Highlights</a>
            <a href="https://prsdube16.blogspot.com/search/label/Everyday%20Novelas?m=1" class="banner-btn">Telenovela Updates</a>
<a href="https://www.mediafire.com/folder/7vznku6zvg906/Insidus+Collection" class="banner-btn">Insidus Plus - Documents And Games</a>
<a href="https://prsdube16.blogspot.com/search/label/Openview%20Plus?m=1" class="banner-btn">Openview Highlights</a>
<a href="https://prsdube16.blogspot.com/p/posts-you-might-like.html?m=1" class="banner-btn">News On Animation</a>
<a href="https://prsdube16.blogspot.com/search/label/Sports%20Entertainment?m=1" class="banner-btn">Sports Highlights</a>
<a href="https://taplink.cc/prsdube16" class="banner-btn">Social Platforms</a>
<a href="https://prsdube16.blogspot.com/search/label/Video%20Entertainment?m=1" class="banner-btn">Streaming Highlights</a>
        </div>
    </div>
</div>

<style>
.custom-banner {
    background-color: #FFFFFF;
    border: 0px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    margin: 10px auto;
    max-width: 1200px; /* Adjust width as needed */
}
.banner-content h3 {
    font-size: 24px;
    margin: 0 0 10px;
    color: #333;
}
.banner-content p {
    font-size: 16px;
    color: #666;
    margin: 0 0 15px;
}
.banner-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}
.banner-btn {
    background-color: #ff0000;
    color: #ffff00 !important;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 5px;
    font-size: 10px;
    transition: background-color 0.3s;
    white-space: nowrap;
}
.banner-btn:hover {
    background-color: #0056b3;
    color: #ffff00
}
@media (max-width: 600px) {
    .custom-banner {
        max-width: 90%;
        padding: 10px;
    }
    .banner-buttons {
        flex-direction: column;
    }
    .banner-btn {
        width: 88%;
        margin-bottom: 10px;
    }
}
</style>

Notes
• By <a></a> you can remove the links within href and replace them with your own
• Before closing with </a> you can give your link a name

Advertisement

How To Add A Recent Posts Slider To Your Blogger Website?

You may have visited a couple of websites and noticed that their posts move automatically in a vertical position and wondered how you can get this on your blogger website. Below is some types on how you can get this widget on your blogger website.

Step 1: Go to Blogger's layout section and click Add Gadgets 

Step 2: You will have to choose HTML/JavaScript and copy the code provided below

Below this recent post slider shows posts based on particular label 

<div id="recent-posts-slider">
  <ul id="recent-posts-list"></ul>
</div>

<style>
#recent-posts-slider {
  overflow: hidden;
  width: auto; /* Ensure full width */
  background: #f9f9f9;
  border: 0px solid #ddd;
  padding: 10px;
}

#recent-posts-list {
  display: flex;
  gap: 15px;
  animation: slide-left linear infinite;
  list-style: none;
  padding: 0;
  margin: 0;
}

#recent-posts-list li {
  min-width: 220px;
  max-width: 220px;
  background: transparent;
  border: 0px solid #ccc;
  padding: 5px;
  box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
  text-align: center;
}

#recent-posts-list img {
  max-width: 100%;
  height: auto;
  margin-bottom: 8px;
}

#recent-posts-list a {
  text-decoration: none;
  color: #ff6a00;
  font-weight: bold;
}

/* Media Queries for responsiveness */
@media (max-width: 768px) {
  #recent-posts-list li {
    min-width: 150px; /* Reduce the min-width on mobile */
    max-width: 150px;
  }
}

@media (max-width: 480px) {
  #recent-posts-list li {
    min-width: 120px; /* Further reduce for smaller screens */
    max-width: 120px;
  }
}

@keyframes slide-left {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}
</style>
<script>
  const feedUrl = "https://prsdube16.blogspot.com/feeds/posts/default/-/Upcoming?alt=json"; // Change 'Tech' to your label
  const list = document.getElementById("recent-posts-list");

  fetch(feedUrl)
    .then(res => res.json())
    .then(data => {
      const posts = data.feed.entry || [];
      posts.slice(0, 10).forEach(post => {
        const title = post.title.$t;
        const link = post.link.find(l => l.rel === "alternate").href;

        let thumb = "https://via.placeholder.com/220x150?text=No+Image";
        if (post.media$thumbnail) {
          thumb = post.media$thumbnail.url;
        } else if (post.content && post.content.$t.match(/<img[^>]+src="([^">]+)/)) {
          thumb = post.content.$t.match(/<img[^>]+src="([^">]+)/)[1];
        }

        const li = document.createElement("li");
        li.innerHTML = `
          <a href="${link}" target="_blank">
            <img src="${thumb}" alt="${title}" />
            <div>${title}</div>
          </a>
        `;
        list.appendChild(li);
      });

      const speed = 40;
      list.style.animationDuration = `${speed}s`;
    })
    .catch(err => {
      console.error("Failed to load recent posts:", err);
      list.innerHTML = "<li>Failed to load posts.</li>";
    });
</script>

This recent posts slider shows all posts by default

<div id="recent-posts-slider">
  <ul id="recent-posts-list"></ul>
</div>

<style>
#recent-posts-slider {
  overflow: hidden;
  width: auto; /* Ensure full width */
  background: #f9f9f9;
  border: 0px solid #ddd;
  padding: 10px;
}

#recent-posts-list {
  display: flex;
  gap: 15px;
  animation: slide-left linear infinite;
  list-style: none;
  padding: 0;
  margin: 0;
}

#recent-posts-list li {
  min-width: 220px;
  max-width: 220px;
  background: transparent;
  border: 0px solid #ccc;
  padding: 5px;
  box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
  text-align: center;
}

#recent-posts-list img {
  max-width: 100%;
  height: auto;
  margin-bottom: 8px;
}

#recent-posts-list a {
  text-decoration: none;
  color: #ff6a00;
  font-weight: bold;
}

/* Media Queries for responsiveness */
@media (max-width: 768px) {
  #recent-posts-list li {
    min-width: 150px; /* Reduce the min-width on mobile */
    max-width: 150px;
  }
}

@media (max-width: 480px) {
  #recent-posts-list li {
    min-width: 120px; /* Further reduce for smaller screens */
    max-width: 120px;
  }
}

@keyframes slide-left {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}
</style>
<script>
  const feedUrl = "https://prsdube16.blogspot.com/feeds/posts/default?alt=json"; 
  const list = document.getElementById("recent-posts-list");

  fetch(feedUrl)
    .then(res => res.json())
    .then(data => {
      const posts = data.feed.entry || [];
      posts.slice(0, 10).forEach(post => {
        const title = post.title.$t;
        const link = post.link.find(l => l.rel === "alternate").href;

        let thumb = "https://via.placeholder.com/220x150?text=No+Image";
        if (post.media$thumbnail) {
          thumb = post.media$thumbnail.url;
        } else if (post.content && post.content.$t.match(/<img[^>]+src="([^">]+)/)) {
          thumb = post.content.$t.match(/<img[^>]+src="([^">]+)/)[1];
        }

        const li = document.createElement("li");
        li.innerHTML = `
          <a href="${link}" target="_blank">
            <img src="${thumb}" alt="${title}" />
            <div>${title}</div>
          </a>
        `;
        list.appendChild(li);
      });

      const speed = 40;
      list.style.animationDuration = `${speed}s`;
    })
    .catch(err => {
      console.error("Failed to load recent posts:", err);
      list.innerHTML = "<li>Failed to load posts.</li>";
    });
</script>

Notes
• By const feedURL replace it with your URL and the Upcoming label replace it with any label on your website
• The const speed widget goes faster if decrease below 40
• By posts slice (0,10) this is where you decide how many posts you want to have displayed