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

@brandonhimpfen/seo-utils

v0.1.0

Published

General-purpose helper functions for common SEO tasks.

Downloads

26

Readme

seo-utils

A lightweight utility library for common SEO tasks.

seo-utils provides small, focused helper functions for tasks that appear frequently in content systems, static sites, publishing workflows, and web applications. It is designed to help normalize and generate common SEO values without requiring a large framework.

Why this project exists

SEO-related logic is often repeated across applications.

One project trims titles manually. Another generates slugs in a slightly different way. A third assembles canonical URLs with custom string logic. Over time, these small inconsistencies create unnecessary duplication and make content systems harder to maintain.

This package provides a simple set of reusable helpers for common SEO tasks.

What is included

  • Slug generation.
  • Title normalization.
  • Meta description trimming.
  • Canonical URL normalization.
  • Robots directive formatting.
  • Open Graph image alt fallback helper.
  • Basic tests.
  • Example usage.

Install

npm install @brandonhimpfen/seo-utils

Example

import {
  slugify,
  normalizeTitle,
  trimMetaDescription,
  normalizeCanonicalUrl,
  formatRobotsDirectives
} from "@brandonhimpfen/seo-utils";

const slug = slugify("The Future of AI Infrastructure");
const title = normalizeTitle("AI Infrastructure", "Brandon Himpfen");
const description = trimMetaDescription(
  "A practical overview of the software, systems, and infrastructure layers that make AI usable at scale.",
  160
);
const canonical = normalizeCanonicalUrl("https://www.example.com/blog/ai-infrastructure/");
const robots = formatRobotsDirectives({
  index: true,
  follow: true,
  maxSnippet: 160
});

console.log({ slug, title, description, canonical, robots });

Design Principles

This project is intentionally minimal.

It focuses on common, reusable SEO helpers rather than full SEO frameworks or site generators. The goal is to provide reliable utilities that can be used across different systems without introducing unnecessary abstraction.

The design emphasizes:

  • Simplicity over feature creep.
  • Predictable outputs over magic behavior.
  • Reusability across publishing workflows.
  • Clear interfaces over configuration-heavy APIs.

API

slugify(input, options?)

Convert a string into a URL-friendly slug.

normalizeTitle(title, siteName?, options?)

Build a title string with optional site branding and maximum length handling.

trimMetaDescription(input, maxLength?)

Trim a description to a target length without cutting words abruptly when possible.

normalizeCanonicalUrl(input, options?)

Normalize a canonical URL by removing duplicate slashes, optionally stripping query strings and hashes, and handling trailing slashes consistently.

formatRobotsDirectives(directives)

Format a robots directive object into a comma-separated string.

getOgImageAlt(input, fallback?)

Return a usable Open Graph image alt string with a fallback when needed.

Roadmap

Future extensions may include:

  • JSON-LD helper generation.
  • hreflang utilities.
  • sitemap helpers.
  • breadcrumb structured data helpers.
  • social meta normalization.

License

MIT