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

@mvp-kit/vite-sitemap-plugin

v0.0.3

Published

Vite plugin for automatic sitemap generation from TanStack Router route tree

Readme

@mvp-kit/vite-sitemap-plugin

A Vite plugin for automatic sitemap generation from TanStack Router route tree.

Part of the MVPKit ecosystem - The fastest way to build production-ready web applications.

Features

  • 🗺️ Automatic sitemap.xml generation from TanStack Router routes
  • 🤖 robots.txt generation with sitemap reference
  • ⚡ Build-time generation (zero runtime overhead)
  • 🎯 SEO-optimized with customizable priorities and changefreq
  • 🔧 Highly configurable with custom route handling
  • 📦 TypeScript support

Installation

npm install @mvp-kit/vite-sitemap-plugin
# or
pnpm add @mvp-kit/vite-sitemap-plugin
# or
yarn add @mvp-kit/vite-sitemap-plugin

Usage

Basic Setup

// vite.config.ts
import { defineConfig } from 'vite'
import { sitemapPlugin } from '@mvp-kit/vite-sitemap-plugin'

export default defineConfig({
  plugins: [
    // ... other plugins
    sitemapPlugin({
      baseUrl: 'https://your-domain.com'
    })
  ]
})

Advanced Configuration

sitemapPlugin({
  baseUrl: 'https://your-domain.com',
  routeTreePath: 'src/routeTree.gen.ts', // TanStack Router route tree
  enabled: process.env.NODE_ENV === 'production',
  includeRobots: true,
  additionalRoutes: ['/sitemap'], // Add custom routes
  excludeRoutes: ['/admin', '/private'], // Exclude routes
  getRoutePriority: (route) => {
    if (route === '/') return 1.0
    if (route.startsWith('/blog')) return 0.9
    return 0.8
  },
  getRouteChangefreq: (route) => {
    if (route === '/') return 'daily'
    if (route.startsWith('/blog')) return 'weekly'
    return 'monthly'
  }
})

Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | baseUrl | string | Required | Base URL for the sitemap | | routeTreePath | string | 'src/routeTree.gen.ts' | Path to TanStack Router route tree | | enabled | boolean | true | Enable/disable sitemap generation | | includeRobots | boolean | true | Generate robots.txt file | | additionalRoutes | string[] | [] | Additional routes to include | | excludeRoutes | string[] | [] | Routes to exclude from sitemap | | getRoutePriority | (route: string) => number | Default logic | Custom priority function | | getRouteChangefreq | (route: string) => string | Default logic | Custom changefreq function |

Default SEO Settings

| Route Pattern | Priority | Change Frequency | |---------------|----------|------------------| | / (Homepage) | 1.0 | daily | | /blog/*, /docs/* | 0.9 | weekly | | /api/*, /reference/* | 0.7 | monthly | | Other routes | 0.8 | weekly |

Output

The plugin generates two files in your build output:

sitemap.xml

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://your-domain.com/</loc>
    <lastmod>2025-09-19</lastmod>
    <changefreq>daily</changefreq>
    <priority>1</priority>
  </url>
  <!-- More URLs... -->
</urlset>

robots.txt

User-agent: *
Allow: /

Sitemap: https://your-domain.com/sitemap.xml

How It Works

  1. Route Detection: Parses TanStack Router's routeTree.gen.ts to extract all routes
  2. SEO Optimization: Applies intelligent defaults or custom logic for priorities and change frequencies
  3. Build Integration: Runs during Vite's build process using the closeBundle hook
  4. File Generation: Creates sitemap.xml and robots.txt in the output directory

TypeScript Support

The plugin is written in TypeScript and includes full type definitions.

import type { SitemapPluginOptions, RouteInfo } from '@mvp-kit/vite-sitemap-plugin'

More from MVPKit

  • MVPKit - Complete toolkit for building production-ready web applications
  • Documentation - Comprehensive guides and API reference
  • Templates - Ready-to-use project templates

License

MIT