0.1.0 • Published 2 years ago

@axelrindle/vite-plugin-sitemap v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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