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

@dukebot/astro-html-validator

v1.1.0

Published

Validate Astro-generated HTML output for SEO metadata, JSON-LD, and internal links.

Downloads

171

Readme

astro-html-validator

Validate Astro-generated HTML output (dist) to catch common technical SEO issues:

  • broken internal links,
  • missing or invalid JSON-LD blocks,
  • missing SEO metadata (title, description, og:*, etc.).

You can use it as:

  1. a CLI (great for CI/CD),
  2. a reusable Node library shared across projects.

Installation

npm install -D @dukebot/astro-html-validator

CLI usage

Default command

npx astro-html-validator

By default it validates ./dist and runs all validators.

Run specific validators

npx astro-html-validator meta
npx astro-html-validator links
npx astro-html-validator jsonld,meta

CLI options

astro-html-validator [selector] [options]

Options:
  --dir <path>      Path to the dist directory (default: <cwd>/dist)
  --quiet           Disable summary output
  --help            Show help

Programmatic usage (Node)

import path from 'node:path';
import { Validator } from '@dukebot/astro-html-validator';

const validator = new Validator({
  dirPath: path.resolve(process.cwd(), 'dist'),
  config: {
    jsonld: {
      requireHtmlLang: true,
      requireInLanguage: true,
      disallowEmptyInLanguage: true,
      requireLangMatch: true,
    },
    links: {},
    meta: {
      metaTitleMinLength: 30,
      metaTitleMaxLength: 60,
      metaDescriptionMinLength: 70,
      metaDescriptionMaxLength: 140,
    },
  },
  print: true,
});

const results = await validator.run({ selector: 'all' });
console.log(results);

Architecture (current)

  • src/index.mjs exports the coordinator class (Validator) that orchestrates all checks.
  • src/validator.mjs now contains the base validator class used via inheritance by concrete validators.
  • Each concrete validator (jsonld, links, meta) encapsulates its own config and page-level validation.

JSON-LD language consistency options

config.jsonld now supports optional checks to validate language consistency between <html lang="..."> and JSON-LD inLanguage values:

  • requireHtmlLang (default: false)
  • requireInLanguage (default: false)
  • disallowEmptyInLanguage (default: false)
  • requireLangMatch (default: false)

When enabled, warnings are reported through the normal validator output ([WARN] /route -> ...) so existing integrations remain backward-compatible.


Suggested scripts for your Astro project

{
  "scripts": {
    "build": "astro build",
    "validate:dist": "astro-html-validator",
    "ci:seo": "npm run build && npm run validate:dist"
  }
}

Publish to npm

Quick steps:

  1. Update name, author, and version in package.json.

    • For this release, use a major bump (breaking changes accepted).
  2. Sign in:

    npm login
  3. Publish:

    npm publish --access public

Breaking change note

@dukebot/astro-html-validator/validator now points to the base validator class (src/validator.mjs) instead of the previous coordinator implementation.