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

hreflang-audit

v1.0.1

Published

Zero-dependency CLI + GitHub Action that audits hreflang (international SEO): return links, invalid locale codes, canonical conflicts, broken alternates.

Readme

hreflang-audit

CI Node.js 20+ License: MIT Zero dependencies

Zero-dependency CLI + GitHub Action that audits your hreflang (international SEO) implementation the way a senior SEO consultant would: return links, invalid locale codes, canonical conflicts, broken alternates — with fix hints and CI-friendly exit codes.

hreflang-audit demo

Quick start

Node.js 20+ is the only requirement — no npm install needed.

git clone https://github.com/madahzadeh/hreflang-audit.git
cd hreflang-audit

node hreflang-audit.mjs https://example.com/          # crawl and audit
node hreflang-audit.mjs --sitemap https://example.com/sitemap.xml
npm run demo                                          # offline demo with seeded issues
npm test                                              # deterministic test suite

What it checks

| Code | Check | Meaning | |---|---|---| | E001 | invalid-code | hreflang value is not a valid ISO 639-1 language (+ optional ISO 15924 script + ISO 3166-1 alpha-2 region), e.g. en-UK (hint: en-GB) | | E002 | underscore-locale | en_US style — hreflang requires hyphens | | E003 | relative-href | hreflang href must be an absolute URL | | E004 | missing-return-link | page A lists B, but B does not link back to A | | E005 | conflicting-entries | the same hreflang value points to two different URLs on one page | | E006 | broken-target | alternate URL returns HTTP ≥ 400 or fails to load | | W101 | missing-self-reference | the page does not include itself in its hreflang set | | W102 | missing-x-default | the set has no x-default entry | | W103 | redirected-target | alternate URL responds with a redirect | | W104 | canonical-mismatch | the target page canonicalizes to a different URL | | W105 | duplicate-entries | exact duplicate hreflang+href pairs on one page |

Annotations are read from HTML <link rel="alternate" hreflang>, HTTP Link: headers, and XML sitemaps (xhtml:link, sitemap-index supported).

CLI options

| Option | Default | Description | |---|---|---| | --sitemap <url> | — | audit a sitemap instead of crawling | | --urls <file> | — | audit an explicit list of URLs (one per line) | | --max-pages <n> | 200 | crawl limit | | --concurrency <n> | 5 | parallel requests | | --timeout <ms> | 10000 | per-request timeout | | --user-agent <ua> | hreflang-audit/1.0 | custom User-Agent | | --fail-on <level> | error | error | warning | none — controls exit code | | --json | — | machine-readable JSON report | | --no-color | — | disable colored output |

Exit codes: 0 clean · 1 findings at/above --fail-on · 2 usage/runtime error.

GitHub Action

name: hreflang
on:
  schedule:
    - cron: "0 6 * * 1"
  workflow_dispatch:

jobs:
  audit:
    runs-on: ubuntu-latest
    steps:
      - uses: madahzadeh/hreflang-audit@main
        with:
          url: https://example.com/
          max-pages: 300
          fail-on: error

JSON output

{
  "summary": { "pagesScanned": 12, "pagesWithHreflang": 8, "errors": 4, "warnings": 3 },
  "findings": [
    {
      "code": "E004",
      "check": "missing-return-link",
      "severity": "error",
      "page": "https://example.com/de/",
      "detail": "https://example.com/en/ (hreflang=\"en\") does not link back to this page",
      "hint": "add <link rel=\"alternate\" hreflang=\"…\" href=\"https://example.com/de/\"> on https://example.com/en/"
    }
  ]
}

Limitations

Honest scope: HTML is parsed with tolerant regexes, not a full DOM — pathological markup may be misread. JavaScript-rendered pages are not executed; audit the server-rendered HTML. This tool complements, but does not replace, Google Search Console's international targeting reports.

Hire me

I build AI automation, release workflows, mobile products, and technical-SEO-driven web systems for founders and international businesses.