Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
sveltekit-static-sitemap
Advanced tools
Generate sitemap at buildtime for SvelteKit applications with prerendered routes. Works with any adapter.
Generates a sitemap.xml
for your page during build. Works by wrapping your existing adapter and writing the sitemap together with the static assets. Currently only prerendered pages will be discovered be included.
Install the package:
npm i -D sveltekit-static-sitemap
Use it in your svelte.config.js
:
import { sitemapWrapAdapter } from "sveltekit-static-sitemap";
const config = {
kit: {
adapter: sitemapWrapAdapter(adapter()),
},
};
export default config;
You can override the default properties for each page, add new pages and set properties on a per page basis:
sitemapWrapAdapter(adapter(), {
// These are the default options for every `<url>` in the sitemap
defaults: {
lastmod: new Date().toISOString(),
priority: 0.5,
chengefreq: "weekly",
},
pages: {
"/": {
// Other values are inherited from default
priority: 1,
},
// Pages which are prerendred by SvelteKit are automatically included
// Other pages can be defined as well
"/dynamic/page": {}, // Will inherit default values
},
});
See the documentation for the sitemapWrapAdapter
function.
Unlike other sitemap generators for SvelteKit, sveltekit-static-sitemap
:
This is posible by wrapping the existing SvelteKit adapter for you project and patching the writePrerendered
function of the SvelteKit Builder
object. This function usually writes static assets and prerendered pages to the correct location for your Adapter. This patched version does the same, but generates the sitemap and pretends it was one of the static assets all along.
Only prerendered pages are included in the sitemap automatically, because these are the only pages we can reliably extract from the Builder
.
FAQs
Generate sitemap at buildtime for SvelteKit applications with prerendered routes. Works with any adapter.
The npm package sveltekit-static-sitemap receives a total of 2 weekly downloads. As such, sveltekit-static-sitemap popularity was classified as not popular.
We found that sveltekit-static-sitemap demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.