npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

blogger-related-posts

v1.1.8

Published

A simple script to display related posts in Blogger

Downloads

17

Readme

Blogger Related Posts

logo

V L

Blogger Related Posts is a plugin that easily generates related posts for Blogger using an enhanced algorithm based on date or relevance. Live Demo →

Features

  • Easy to use: Just include the script and call the init() method — no setup hassle.
  • Customizable: Style and configure related posts via options and data attributes.
  • Lightweight: Minimal footprint with zero dependencies.
  • Lazy loading: Loads related posts efficiently using IntersectionObserver.
  • Shuffle algorithm: Randomize the order of related posts using a shuffle algorithm.
  • YouTube integration: Automatically retrieves video thumbnails from YouTube.
  • Always relevant: Generates related content even when labels are missing.

Requirements

  • The blog must be public and have feeds enabled.

Installation

npm

npm i blogger-related-posts

cdn

<script src="https://cdn.jsdelivr.net/npm/blogger-related-posts@1/dist/main.min.js"></script>

How to use

You can use blogger-related-posts as an ES6 module or as a global script. For example:

import BloggerRelated from 'blogger-related-posts'

new BloggerRelated().init()

If you are using it as a global script, you can access it via the BloggerRelated global variable:

new BloggerRelated().init()

if you want to run JavaScript code after the related posts are generated, you can use the init method, which returns a promise that resolves when the related posts are ready:

new BloggerRelated().init().then(() => {
  // Your code here
})

Now, you need create a container for the related posts (with the id blog-related by default). For example:

<div id="blog-related"></div>

Options

You can customize blogger-related-posts using the following options:

| Option | Type | Description | Default | |-----------------------|---------|--------------------------------------------------|------------------------| | relatedSelector | String | Selector for the related posts container | #blog-related | | template | String | Template for the related posts | See defaults.js | | textOnlyTemplate | String | Template for the related posts without image | null | | defaultImage | String | Default image for the related posts | '' | | directory | String | Directory for the related posts | summary | | imageParams | String | Image parameters for the related posts | s120-c | | maxResults | Number | Maximum number of related posts | 5 | | observer | Boolean | Use IntersectionObserver for lazy loading | true | | orderby | String | Order by relevance or date | relevance | | postId | Number | Post ID for the current post | 0 | | postTitle | String | Post title for the current post | document.title | | rootMargin | String | Root margin for the IntersectionObserver | 200px | | shuffleLevel | Number | Shuffle level for the related posts | 5 | | summaryLength | Number | Maximum length of the summary | 120 | | tags | Array | Tags for the related posts | [] | | ytThumbnail | String | YouTube thumbnail type | mqdefault |

For example, to customize the number of visible pagination links and disable update checking:

new BloggerRelated({
  maxResults: 10,
  tags: ['tag1', 'tag2']
}).init()

Additionally, you can configure the instance in the HTML using data-* attributes on the container. For example:

<div id="blog-related" data-max-results="10" data-tags='["tag1", "tag2"]'></div>

Templating

These elements are used in the HTML of the templates and return the corresponding value:

| Element | Description | |-------------------|------------------------------------| | {postId} | Entry ID | | {title} | Entry title | | {published} | Entry publication date | | {summary} | Entry summary | | {postUrl} | Entry URL | | {authorImage} | Entry author's image | | {authorName} | Entry author's name | | {authorUrl} | Entry author's URL | | {featuredImage} | Entry featured image |

When writing the template, you can include these elements in the HTML. For example:

<a href="{postUrl}">
  <img src="{featuredImage}" alt="{title}" />
  <h2>{title}</h2>
  <p>{summary}</p>
  <p>By {authorName}</p>
  <p>Published on {published}</p>
</a>

Methods

All methods are available through the instance of BloggerRelated:

| Method | Description | Returns | |------------|-------------------------------|---------| | init() | Initializes the related posts | Promise |

Supporting

If you want to help me keep this and other related projects always up to date, you can buy me a coffee ☕. I will be very grateful 👏.

License

blogger-related-posts is licensed under the MIT License