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

@itznotabug/routex

v0.0.3

Published

A client side redirection plugin for Vitepress.

Downloads

39

Readme

Routex

A powerful client-side redirection plugin for VitePress that generates static redirect pages and handles seamless navigation between old and new URLs.

✨ Features

  • 🔄 Client-side redirects - Fast, seamless navigation without server configuration
  • 📄 Static redirect pages - Generates HTML files for each redirect during build
  • 🎨 Custom templates - Use your own redirect page design or stick with the beautiful default
  • Zero JavaScript fallback - Works even with JavaScript disabled via meta refresh
  • 🔍 SEO friendly - Proper meta tags, canonical links, and no-index options
  • 🛡️ Validation - Detects circular redirects, conflicts, and dead links
  • ⚙️ Flexible configuration - Simple redirect maps or advanced options

📦 Installation

pnpm add -D @itznotabug/routex

🚀 Quick Start

Add routex to your VitePress configuration:

// .vitepress/config.ts
import { routex } from 'routex'
import { defineConfig } from 'vitepress'

export default defineConfig({
    // ... your VitePress config
    vite: {
        plugins: [
            routex({
                '/old-page': '/new-page',
                '/legacy/docs': '/docs',
                '/api/v1': '/api/v2'
            })
        ]
    }
})

Routex will automatically:

  • Handle navigation seamlessly
  • Inject client-side redirect scripts
  • Generate redirect pages at build time

📖 Usage

Simple redirects

routex({
    '/old-page': '/new-page',
    '/legacy': '/modern',
    '/blog/2023': '/blog/archive/2023'
})

Advanced configuration

routex({
    rules: {
        '/old-api': '/api/v2',
        '/docs/legacy': '/docs',
        '/external-link': 'https://example.com'
    },
    options: {
        redirectDelay: 2,        // Delay in seconds (default: 0)
        addCanonical: true,      // Add canonical link tags (default: false)
        addNoIndexMeta: true,    // Add noindex meta tag (default: false)
        template: './custom-redirect.html',  // Custom template path
        overrideExisting: false, // Allow overriding existing pages (default: false)
        ignoreDeadLinks: false   // Skip validation for missing destinations (default: false)
    }
})

Custom Template

Create a custom redirect template with placeholders:

<!-- custom-redirect.html -->
<!DOCTYPE html>
<html lang="en">
  <head>
      <meta charset="UTF-8">
      <title>Redirecting to {destination}</title>
      {metaTags}
      <style>
          body {
              font-family: system-ui;
              text-align: center;
              padding: 50px;
          }
      </style>
      <script>
          setTimeout(() => {
              location.replace('{destination}');
          }, {redirectDelay} * 1000);
      </script>
  </head>
  <body>
    <h1>🚀 Moving to a better place...</h1>
    <p>You're being redirected from <code>{source}</code> to <code>{destination}</code></p>
    <p><a href="{destination}">Click here if you're not redirected automatically</a></p>
  </body>
</html>

Available placeholders:

  • {source} - Original URL path
  • {destination} - Target URL
  • {redirectDelay} - Delay in seconds
  • {metaTags} - Generated meta tags (refresh, canonical, noindex)

⚙️ Configuration Options

| Option | Type | Default | Description | |--------------------|-----------|---------|-----------------------------------------------| | enable | boolean | true | Enable/disable the plugin | | redirectDelay | number | 0 | Delay before redirect (seconds) | | addCanonical | boolean | false | Add canonical link tags for SEO | | addNoIndexMeta | boolean | false | Add noindex meta tag to prevent indexing | | template | string | '' | Path to custom template or inline HTML | | overrideExisting | boolean | false | Allow redirects to override existing pages | | ignoreDeadLinks | boolean | false | Skip validation for missing destination pages |

🔍 Validation

Routex automatically validates your redirect configuration:

  • Self-references - Detects redirects that point to themselves
  • Circular redirects - Prevents infinite redirect loops
  • Path validation - Ensures proper URL formatting
  • File conflicts - Warns about redirects that override existing pages
  • Dead links - Checks if destination pages exist

🤝 Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes and add tests
  4. Ensure tests pass: pnpm test:run
  5. Commit your changes: git commit -m 'Add amazing feature'
  6. Push to the branch: git push origin feature/amazing-feature
  7. Open a Pull Request

🙏 Acknowledgments


⭐ Star this repo if you find it useful!