Svelte Sitemap screenshot

Svelte Sitemap

Author Avatar Theme by Bartholomej
Updated: 15 Jun 2025
335 Stars

Sitemap generator for SvelteKit. Small helper which scans your SvelteKit routes and generates static sitemap.xml

Overview

The Svelte sitemap.xml generator is a small helper tool designed for SvelteKit adapter-static with prerender option (SSG). It scans your Svelte routes and generates a sitemap.xml file for your website. It supports TypeScript and JavaScript, and can be used as a CLI tool or directly from your code. It also provides useful options for customizing your sitemap and integrates with Google Search Console.

Features

  • Designed for SvelteKit adapter-static with prerender option (SSG): This tool is specifically designed for use with SvelteKit adapter-static and supports prerendering of pages.

  • Support for TypeScript, JavaScript, CLI version: The tool supports both TypeScript and JavaScript, and can be used as a CLI tool or directly from your code.

  • Useful options for customizing your sitemap: The tool provides various options for customizing your sitemap, such as setting a custom build folder, ignoring files or folders, adding trailing slashes, setting the lastModified time, and setting the change frequency.

  • Support for submitting sitemap to Google Search Console: The tool integrates with Google Search Console, allowing you to easily submit your sitemap for indexing.

  • Support for Google sitemap index: If you have a large website with more than 50,000 pages, the tool supports generating a Google sitemap index, which helps with efficiently managing and indexing large sites.

  • Compatible with Vercel hosting: The tool is compatible with Vercel hosting, making it easy to generate and manage your sitemap for SvelteKit projects hosted on Vercel.

  • Workaround for official SvelteKit issue: The tool provides a workaround for an official SvelteKit issue, ensuring that your sitemap generation process runs smoothly.

Installation

To install the Svelte sitemap.xml generator, you can follow these steps:

  1. Open your package.json file.
  2. Add the following configuration under the “scripts” section:
"scripts": {
  "postbuild": "svelte-sitemap-generator"
}
  1. Run the following command to install the package:
npm install svelte-sitemap-generator
  1. After installation, you can configure the options for the generator in your package.json file. For example:
"scripts": {
  "postbuild": "svelte-sitemap-generator --domain https://mydomain.com --out-dir dist"
}
  1. Run the build command for your SvelteKit project. The sitemap.xml file will be generated in the specified output directory.

Summary

The Svelte sitemap.xml generator is a useful tool for generating sitemap.xml files for SvelteKit projects using the adapter-static with prerender option. It provides various customization options and integrates with Google Search Console for easy submission. With its compatibility with Vercel hosting and workaround for official SvelteKit issues, it offers a convenient solution for managing and generating sitemaps for SvelteKit websites.