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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@photogabble/eleventy-plugin-blogtimes

v1.0.0

Published

Blogtimes graph generator for 11ty

Downloads

5

Readme

Blogtimes Eleventy Plugin

Blogtimes is a plugin for the Eleventy static site generator, written in JavaScript. Given a directory with a valid git repository it will generate a histogram of commit times over 24 hours defaulting to within the past 30 days.

It's a direct port from PHP of the WordPress plugin Blogtimes, which was itself ported to WordPress by Matt Mullenweg from b2 in 2003.

Here is a screenshot of what its output looks like: Blogtimes Histogram of git commit times, the x axis is in hours from 0 to 23, there are vertical lines to show minutes from midnight each git commit was made. The lines are shaded, the darker they are the more commits there were at that time

Why?

I have been building websites and blogging since 1999, starting with hand coded html in notepad, I quickly picked up b2 and soon after WordPress. Around that time I was an avid subscriber to Matt's blog and so when they shared their port of Blogtimes for WordPress (I believe it was the second WordPress plugin,) I immediately gave it a go.

For a number of years, every so often I would remember that histogram but not where it came from. In 2019 I began researching and in 2022 I finally published what I had found in Blogtimes: A trip down memory lane. In January of 2023 Mike Little's post on Mastodon reminded me of this whole escapade and I decided to port the plugin to Eleventy.

18 years ago Matt ported it to WordPress from Sanjay Sheth's b2 version, I have continued that tradition by porting it to JavaScript for use with Eleventy. Long may it continue to be used and toyed with - code is poetry.

You can browse the WordPress versions source over at their trac service .

Install

npm i @photogabble/eleventy-plugin-blogtimes

Configuration

type EleventyPluginBlogtimesOptions = {
  width?: number, // Image Width, default: 480
  height?: number, // Image Height, default: 80
  title?: string, // Title output top left, default: 'Git Commits'
  lastXDays?: number, // Time period in days, default: 30
  hPadding?: number, // Padding top and bottom, default: 5
  vPadding?: number, // Padding left and right, default: 5
  showTicks?: boolean, // Show ticks, default: true
  unitName?: string, // Units, displayed centered at bottom, default: 'hour of day'

  outputFileExtension: string, // Image mimetype, default: 'png, must be either png or jpg
  outputDir: string, // Image output directory, default: 'bt-images'
  urlPath: string, // Image url path, default: 'bt-images'
  hashLength?: number, // Image filename hash length, default: 10

  generateHTML?: Function,
}

Usage

In your Eleventy config file (defaults to .eleventy.js):

module.exports = (eleventyConfig) => {
  eleventyConfig.addPlugin(require('@photogabble/eleventy-plugin-blogtimes'),{});
};

You will now be able to use the blogtimes shortcode in your templates:

{% blogtimes %}

By default, blogtimes will process the git stats for the repository its run in. You can change that by passing an absolute path to the shortcode.

Libraries in use

License

This 11ty plugin is open-sourced software licensed under the MIT License. Also included in this repository are classic X Window System bitmap fonts which are considered to be public domain.