@axelrindle/vite-plugin-sitemap
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

CI npm (scoped) commit style changelog style

vite-plugin-sitemap

🗺 Generate a sitemap

Generated sitemaps adhere to the protocol described on sitemaps.org.

Install

npm i @axelrindle/vite-plugin-sitemap

Usage

import sitemap from '@axelrindle/vite-plugin-sitemap'
import { defineConfig } from 'vite'

export default defineConfig({
    plugins: [
        sitemap()
    ]
})

Configuration

The sitemap function accepts an object with the following options:

pages

An array of Page objects describing the basic structure you want your sitemap to represent.

A Page has the following structure:

interface Page {
    // ------------------------------------
    // the relative path to the source file
    // this can be any type of file
    file: string

    // ------------------------------------
    // the relative url where the page
    // is accessible within your website
    route: string

    // ------------------------------------
    // a value between 0.0 and 1.0
    // defaults to 0.5
    priority?: number
}

output

The output directory to place the sitemap in.

Defaults to public.

baseUrl

A base url to prefix all pages with.

TODO

  • Automatic loading & processing of react-router route definitions

License

MIT

Package Sidebar

Install

npm i @axelrindle/vite-plugin-sitemap

Weekly Downloads

7

Version

0.1.0

License

MIT

Unpacked Size

8.91 kB

Total Files

6

Last publish

Collaborators

  • axelrindle