Generate a sitemap automatically for your site

Options See on

filename string

The sitemap file name

query string

The query to search pages included in the sitemap

sort string

The values to sort the sitemap

lastmod string function

The key to use for the lastmod field or a custom function

changefreq string function

The key to use for the changefreq field or a custom function

priority string function

The key to use for the priority field or a custom function


This plugin generates a sitemap.xml file automatically with all your pages, which is useful for SEO. See the Sitemaps XML format specification for more info.

It also creates a robots.txt file that include a link to the sitemap file, so it's easier to discover for the search engines.


Import this plugin in your _config.ts file to use it:

import lume from "lume/mod.ts";
import sitemap from "lume/plugins/sitemap.ts";

const site = lume();

site.use(sitemap(/* Options */));

export default site;


Internally, this plugin uses Search to search and return the pages. By default, all pages are included in the sitemap (except the 404 page) and sorted by URL. You can setup a different configuration:

  filename: "my-sitemap.xml", // to change the sitemap filename
  query: "indexable=true", // Select only pages with the indexable attribute as true
  sort: "date=desc", // To sort by data in ascendent order