Plugins

Sitemap

Auto-generate sitemap.xml for search engines.

Sitemap

Automatically generates /sitemap.xml from your page routes. Dynamic routes (e.g. [slug], [...path]) are excluded automatically.

Installation

bun add @manicjs/sitemap

Quick Start

// manic.config.ts
import {  } from 'manicjs/config';
import {  } from '@manicjs/sitemap';

export default ({
  : [
    ({
      : 'https://example.com',
    }),
  ],
});

The plugin uses createPlugin with staticFiles, so the sitemap is served as a route in dev and emitted as a static file in production — no extra configuration needed.

Options

Prop

Type

Example Configuration

import {  } from 'manicjs/config';
import {  } from '@manicjs/sitemap';

export default ({
  : [
    ({
      : 'https://example.com',
      : 'daily',
      : 0.9,
      : ['/admin', '/private'],
    }),
  ],
});

Output

Generated /sitemap.xml:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://example.com/</loc>
    <changefreq>daily</changefreq>
    <priority>0.9</priority>
  </url>
  <url>
    <loc>https://example.com/about</loc>
    <changefreq>daily</changefreq>
    <priority>0.9</priority>
  </url>
</urlset>

Dynamic Route Exclusion

Routes with dynamic segments are excluded automatically — you don't need to add them to exclude. For example, if your app/routes/ contains:

  • index.tsx → included as /
  • about.tsx → included as /about
  • blog/[slug].tsx → excluded (dynamic)
  • [...path].tsx → excluded (catch-all)

Only static routes appear in the sitemap.

Integration with SEO

Pair with @manicjs/seo for complete search engine optimization. The SEO plugin handles robots.txt (with automatic /sitemap.xml reference) and meta tags, while the sitemap plugin generates the XML sitemap:

import {  } from 'manicjs/config';
import {  } from '@manicjs/seo';
import {  } from '@manicjs/sitemap';

export default ({
  : [
    ({
      : 'https://example.com',
      : 'My App',
    }),
    ({
      : 'https://example.com',
    }),
  ],
});

When autoSitemap is true (the default in @manicjs/seo), the SEO plugin automatically adds /sitemap.xml to robots.txt.

See Also

On this page