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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@nera-static/plugin-statistics

v2.0.0

Published

A plugin for the Nera static site generator that creates statistics by counting page properties like categories, topics, or any other metadata field.

Readme

@nera-static/plugin-statistics

A plugin for the Nera static site generator that creates statistics by counting page properties like categories, topics, tags, or any other metadata field.

✨ Features

  • Count any page metadata property across your site
  • Automatically sorts results alphabetically
  • Configurable properties via YAML configuration
  • Multiple display templates (table, cards, list)
  • Ready-to-use Pug templates with BEM CSS classes
  • Full ES Module support

🚀 Installation

Install the plugin in your Nera project:

npm install @nera-static/plugin-statistics

Nera will automatically detect the plugin and generate statistics during the build.

🛠️ Usage

Configuration

Configure which properties to count in your project:

# config/statistics.yaml
count:
    - category
    - topic
    - tags

# Optional: Display settings
display:
    show_counts: true
    sort_by: 'name' # "name" or "count"
    sort_order: 'asc' # "asc" or "desc"

Page Metadata

Add the configured properties to your markdown pages:

---
title: My Blog Post
category: Tech
topic: JavaScript
tags: frontend
---

Publish Templates

Copy the default templates to your project:

npx @nera-static/plugin-statistics run publish-template

This copies the templates to:

views/vendor/plugin-statistics/statistics.pug
views/vendor/plugin-statistics/statistics-cards.pug
views/vendor/plugin-statistics/statistics-list.pug

Using the templates

Include the statistics in your Pug templates:

include views/vendor/plugin-statistics/statistics
// or
include views/vendor/plugin-statistics/statistics-cards
// or
include views/vendor/plugin-statistics/statistics-list

The plugin provides three different template files:

  • statistics.pug - Table format with headers (default)
  • statistics-cards.pug - Card-based layout
  • statistics-list.pug - Simple list format

Available Data

The plugin adds statistics to the app object:

app.statistics = {
    category: [
        { name: 'Tech', amount: 5 },
        { name: 'Design', amount: 3 },
    ],
    topic: [
        { name: 'JavaScript', amount: 4 },
        { name: 'CSS', amount: 2 },
    ],
    tags: [
        { name: 'frontend', amount: 6 },
        { name: 'backend', amount: 2 },
    ],
}

🎨 CSS Classes

The plugin uses BEM (Block Element Modifier) methodology:

  • .statistics - Main statistics container
  • .statistics__category - Category section
  • .statistics__title - Category title
  • .statistics__table - Table layout
  • .statistics__header - Table headers
  • .statistics__row - Table rows
  • .statistics__cell - Table cells
  • .statistics__cell--count - Count cell modifier
  • .statistics__cards - Cards container
  • .statistics__card - Individual card
  • .statistics__card-name - Card name
  • .statistics__card-count - Card count
  • .statistics__list - List container
  • .statistics__item - List item
  • .statistics__name - Item name
  • .statistics__count - Item count

🧪 Development

npm install
npm test
npm run lint

Tests use Vitest and cover:

  • Property counting functionality
  • Alphabetical sorting
  • Data structure validation
  • Edge cases and error handling

🔄 Compatibility

  • Nera v4.1.0+: Full compatibility with latest static site generator
  • Node.js 18+: Modern JavaScript features and ES modules
  • Plugin Utils v1.1.0+: Enhanced plugin utilities integration

🏗️ Architecture

This plugin uses the getAppData() function to process page metadata and generate statistics. It counts occurrences of configured properties across all pages and provides the data globally via the app.statistics object.

🧑‍💻 Author

Michael Becker
https://github.com/seebaermichi

🔗 Links

📦 License

MIT