Sitemap

Generate a site map for the web crawlers to collect.

Installation

npm i @gracile/sitemap
πŸ“„ /vite.config.ts

import { defineConfig } from 'vite';

import { viteSitemapPlugin } from '@gracile/sitemap/vite'; 

const SITE_URL = 'https://example.com/';

export default defineConfig({
  // ...

  plugins: [
    viteSitemapPlugin({
       This is mandatory.
      siteUrl: SITE_URL,
       This is the default robots.txt that you can override if needed.
      robotsTxt: [
        ['User-agent', '*'],
        ['Allow', '/'],
        ['Sitemap', `${SITE_URL}sitemap.xml`],
      ],
    }),
    // ...
  ],
});

Based on sitemap.