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

@turingnova/sitemap

v1.0.8

Published

Dynamic sitemap generator for Next.js applications with industry standards compliance

Readme

@turingnova/sitemap

A dynamic sitemap generator for Next.js applications that follows industry standards and generates SEO-optimized XML sitemaps.

Features

  • 🚀 Dynamic Generation: Automatically detects pages and routes
  • 📱 Next.js Compatible: Works with both App Router and Pages Router
  • 🎯 SEO Optimized: Follows sitemap protocol standards
  • ⚙️ Configurable: Flexible configuration options
  • 🔄 Auto-updating: Integrates with build process
  • 📊 Multiple Formats: Supports sitemap index for large sites
  • 🎨 Priority & Frequency: Customizable priority and change frequency
  • 📅 Last Modified: Automatic last modified dates

Installation

npm install @turingnova/sitemap

Quick Start

1. Initialize Sitemap Configuration

# Initialize with automatic site URL detection
npx init sitemap

# Or with custom options
npx init sitemap --siteUrl https://yourdomain.com --outDir public

# Skip prompts with defaults
npx init sitemap --yes

This will create:

  • sitemap.config.js - Main configuration file
  • app/sitemap.ts - App Router integration (if app directory exists)
  • pages/sitemap.xml.tsx - Pages Router integration (if pages directory exists)
  • examples/ - Example configurations
  • Updated package.json scripts

2. Generate Sitemap

# Using npm script
npm run sitemap

# Using npx
npx sitemap

# Using npx with options
npx sitemap --siteUrl https://yourdomain.com --outDir public

3. Access Your Sitemap

Visit https://yourdomain.com/sitemap.xml to see your generated sitemap.

Note: The sitemap is automatically accessible at your domain root (e.g., yourdomain.com/sitemap.xml).

Configuration

Basic Configuration

// sitemap.config.js
module.exports = {
  siteUrl: "https://yourdomain.com",
  sitemapSize: 7000,
  changefreq: "daily",
  priority: 0.7,
};

Advanced Configuration

// sitemap.config.js
module.exports = {
  siteUrl: "https://yourdomain.com",
  sitemapSize: 7000,
  changefreq: "daily",
  priority: 0.7,

  // Exclude specific paths
  exclude: ["/admin/*", "/private/*", "/api/*"],

  // Custom transformations
  transform: async (config, path) => {
    return {
      loc: path,
      changefreq: config.changefreq,
      priority: config.priority,
      lastmod: new Date().toISOString(),
    };
  },

  // Additional paths
  additionalPaths: async (config) => {
    const result = [];

    // Add dynamic routes
    const posts = await getPosts();
    posts.forEach((post) => {
      result.push({
        loc: `/blog/${post.slug}`,
        changefreq: "weekly",
        priority: 0.8,
        lastmod: post.updatedAt,
      });
    });

    return result;
  },
};

CLI Commands

Initialize Configuration

npx init sitemap [options]

Options:

  • -u, --siteUrl <url> - Your website URL
  • -o, --outDir <path> - Output directory (default: public)
  • -y, --yes - Skip prompts and use defaults

Generate Sitemap

npm sitemap generate [options]
# or
npx sitemap [options]

Options:

  • -c, --config <path> - Path to config file (default: sitemap.config.js)
  • -o, --outDir <path> - Output directory (default: public)
  • -u, --siteUrl <url> - Website URL
  • --gzip - Generate gzipped sitemap

API Reference

Configuration Options

| Option | Type | Default | Description | | ----------------- | -------- | ------- | ----------------------------- | | siteUrl | string | - | Your website URL (required) | | sitemapSize | number | 7000 | Maximum URLs per sitemap file | | changefreq | string | 'daily' | Default change frequency | | priority | number | 0.7 | Default priority | | exclude | string[] | [] | Paths to exclude | | transform | function | - | Custom URL transformation | | additionalPaths | function | - | Add custom URLs |

Programmatic Usage

const { generateSitemap } = require("@turingnova/sitemap");

const config = {
  siteUrl: "https://yourdomain.com",
  // ... other options
};

generateSitemap(config);

Integration with Next.js

App Router

Create app/sitemap.ts:

import { generateSitemap } from "@turingnova/sitemap";

export default async function sitemap() {
  const config = {
    siteUrl: "https://yourdomain.com",
    // ... your config
  };

  return generateSitemap(config);
}

Pages Router

Create pages/sitemap.xml.tsx:

import { GetServerSideProps } from "next";
import { generateSitemap } from "@turingnova/sitemap";

export const getServerSideProps: GetServerSideProps = async ({ res }) => {
  const config = {
    siteUrl: "https://yourdomain.com",
    // ... your config
  };

  const sitemap = await generateSitemap(config);

  res.setHeader("Content-Type", "text/xml");
  res.write(sitemap);
  res.end();

  return {
    props: {},
  };
};

export default function Sitemap() {
  return null;
}

Package.json Scripts

After running npx init sitemap, your package.json will include:

{
  "scripts": {
    "sitemap": "turingnova-sitemap",
    "sitemap:generate": "turingnova-sitemap"
  }
}

Industry Standards Compliance

This package follows the Sitemap Protocol and includes:

  • ✅ Valid XML structure
  • ✅ Proper namespace declarations
  • ✅ Required URL elements (loc)
  • ✅ Optional elements (lastmod, changefreq, priority)
  • ✅ Sitemap index support for large sites
  • ✅ Compression support (gzip)
  • ✅ Proper HTTP headers

License

MIT License - see the LICENSE file for details.

Support