Skip to content

Qalisa/vike-plugin-sitemap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vike Sitemap Plugin

A Vike plugin for handling sitemap.xml and/or robots.txt file generation automatically, based on your project structure.

Features

  • Automatically generates a sitemap.xml based on your pages/ directory.
  • Supports custom sitemap entries.
  • Generates a robots.txt file with configurable rules.
  • Updates in development mode when files change.
  • Fully configurable options.

Installation

npm install -D @qalisa/vike-plugin-sitemap

or

yarn add --dev @qalisa/vike-plugin-sitemap

or

pnpm install -D @qalisa/vike-plugin-sitemap

Usage

In your Vike project root, add the plugin to your Vite configuration file:

// vite.config.ts
import sitemap from '@qalisa/vike-plugin-sitemap';

export default {
  plugins: [sitemap({
    baseUrl: 'https://yourwebsite.com' // can be omited in dev
  })]
};

Configuration Options

Option Type Default Description
pagesDir string 'pages' Directory containing your Vike pages.
baseUrl string 'http://localhost:3000' Base URL of your website.
filename string 'sitemap.xml' Name of the sitemap file.
outputDir string '.' Output directory for the sitemap and robots.txt, relative to your output bundle client files.
defaultChangefreq string 'weekly' Default change frequency for pages.
defaultPriority number 0.5 Default priority for pages.
customEntries SitemapEntry[] [] Additional custom sitemap entries.
sitemapGenerator function (entries) => entries Function to modify parsed entries before custom entries are added.
robots RobotsOptions or false { userAgent: '*', disallow: { cloudflare: true } } Robots.txt options. If you pass false, no robots.txt is generated

License

MIT License

About

Generate a sitemap, for Vike projects

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •