Skip to content

jl917/rspress-plugin-sitemap

Repository files navigation

rspress-plugin-sitemap NPM Version

Rspress plugin for Automatically generate SEO(Search Engine Optimization)-related sitemaps

Usage

npm i rspress-plugin-sitemap
yarn add rspress-plugin-sitemap
pnpm add rspress-plugin-sitemap
import { defineConfig } from "rspress/config";
import sitemap from "rspress-plugin-sitemap";

export default defineConfig({
  plugins: [
    sitemap({
      domain: "https://rspress.dev",
      customMaps: {
        "/sample": {
          loc: "/sample",
          lastmod: "2024-04-27T07:44:43.422Z",
          priority: "0.7",
          changefreq: "always",
        },
      },
      defaultChangeFreq: "monthly",
      defaultPriority: "0.5",
    }),
  ],
});

Configure

This plugin supports passing in an object configuration. The properties of this object configuration are as follows:

interface Options {
  domain?: string; // your domain
  customMaps?: CustomMaps; // custom your sitemap
  defaultPriority?: Priority; // defaultPriority 0.5
  defaultChangeFreq?: ChangeFreq; // defaultPriority monthly
}
  • domain Customize your domain name
  • customMaps Customize the sitemap for a specific path
  • defaultPriority Setting default global priority
  • defaultChangeFreq Setting default global changeFreq