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 🙏

© 2025 – Pkg Stats / Ryan Hefner

tanstack-router-sitemap

v1.0.13

Published

Generate sitemap for TanStack Router

Readme

Tanstack Router Sitemap

Features

  • ✅ Generates sitemap.xml from your routes
  • ✅ Extends full type safety from TanStack Router with autocomplete
  • ✅ Supports dynamic routes

Installation

npm install --save-dev tanstack-router-sitemap

Usage

// utils/sitemap.ts
import { type FileRouteTypes } from "@/routeTree.gen";
import { Sitemap } from "tanstack-router-sitemap";

// This will become a string literal union of all your routes
export type TRoutes = FileRouteTypes["fullPaths"];

// Define your sitemap
export const sitemap: Sitemap<TRoutes> = {
  siteUrl: "https://example.com",
  defaultPriority: 0.5,
  routes: {
    "/home": {
      priority: 1,
      changeFrequency: "daily",
    },
    // Dynamic route example
    "/posts/$postId": async (route) => {
      const postsResponse = await fetch("https://example.com/api/posts");
      const posts = await postsResponse.json();

      return posts.map((post) => ({
        path: `/posts/${post.id}`,
        priority: 0.8,
        changeFrequency: "daily",
      }));
    },
  },
};
// app.config.ts

import { defineConfig } from "@tanstack/start/config";
import { generateSitemap } from "tanstack-router-sitemap";

// import the sitemap you defined earlier
import { sitemap } from "@/utils/sitemap";

export default defineConfig({
  server: {},
  vite: {
    plugins: [generateSitemap(sitemap)],
  },
});

This plugin will generate a sitemap.xml file in your public directory.

Configuration Options

| Name | Type | Description | | -------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | | siteUrl | string | The base URL of your site | | defaultPriority? | number | The default priority for all routes | | defaultChangeFreq? | "always" | "hourly" | "daily" | "weekly" | "monthly" | "yearly" | "never" | The default change frequency for all routes | | routes | {[route: string]: Route \| Route[] \| async (route) => Route[] } | Only static routes can return a Route, dynamic routes must return an array of Route. See below for full Route details |

Route Configuration

| Name | Type | Description | | ------------------ | --------------------------------------------------------------------------------------------- | ------------------------------------------------------- | | path | string | The path of the route Only for dynamic routes | | priority? | number | The priority of the route | | changeFrequency? | "always" | "hourly" | "daily" | "weekly" | "monthly" | "yearly" | "never" | The change frequency of the route | | lastModified? | string | Date | The last modified date of the route |

License

MIT