vite-sitemap
Version:
Vite plugin for generating sitemaps
41 lines (40 loc) • 1.26 kB
TypeScript
import type { PluginOption } from "vite";
export type Changefreq = "always" | "hourly" | "daily" | "weekly" | "monthly" | "yearly" | "never";
interface Entry {
path: string;
lastmod?: string;
changefreq?: Changefreq;
priority?: number;
}
export type SitemapEntry = string | Entry;
interface Options extends Omit<Entry, "path"> {
base?: string;
urls?: SitemapEntry[];
fileName?: string;
robotsTxt?: boolean | string | null;
}
/**
* Remove leading and trailing slashes
*/
export declare const unslash: (str: string) => string;
/**
* Ensure string ends with a slash
*/
export declare const adslash: (str: string) => string;
/**
* Generate a single sitemap entry
*/
export declare const sitemapEntry: (base: string, entry: SitemapEntry, options: Options) => string;
/**
* Generate sitemap entries
*/
export declare const sitemapEntries: (base: string, entries: SitemapEntry[], options: Options) => string;
/**
* Generate robots.txt file if enabled
*/
export declare function emitRobotsTxt(this: any, robotsTxt: string | boolean | null | undefined, base: string): void;
/**
* Vite plugin to generate sitemap.xml (and optionally robots.txt)
*/
export default function sitemap(options?: Options): PluginOption;
export {};