This plugin generates a sitemap for a Deno Fresh v2 project. It scans the routes and articles directories to generate an XML sitemap, supporting multiple languages and a default language without a language prefix.
routes
and articles
directories for valid pages.Install the Plugin
Import the functions from the module to use within your Fresh project.
import { saveSitemap } from 'jsr:@elsoul/fresh-sitemap'
Run the Plugin
Use the saveSitemap
function in your build script to generate sitemap.xml
after your Fresh routes and articles are compiled.
// Example usage await saveSitemapAndRobots({ basename: `https://${appInfo.domain}`, distDirectory: 'routes', postsDirectory: 'posts', sitemapPath: 'static/sitemap.xml', robotsPath: 'static/robots.txt', options: { languages: ['en', 'ja'], defaultLanguage: 'en' }, })
Options
languages
: Array of languages, such as ["en", "ja"]
.defaultLanguage
: Default Language.Bug reports and pull requests are welcome on GitHub at https://github.com/elsoul/fresh-sitemap. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The package is available as open source under the terms of the Apache-2.0 License.
Everyone interacting in the SKEET project’s codebases, issue trackers, chat rooms, and mailing lists is expected to follow the code of conduct.
Add Package
deno add jsr:@elsoul/fresh-sitemap
Import symbol
import * as fresh_sitemap from "@elsoul/fresh-sitemap";
---- OR ----
Import directly with a jsr specifier
import * as fresh_sitemap from "jsr:@elsoul/fresh-sitemap";
Add Package
npx jsr add @elsoul/fresh-sitemap
Import symbol
import * as fresh_sitemap from "@elsoul/fresh-sitemap";
Add Package
yarn dlx jsr add @elsoul/fresh-sitemap
Import symbol
import * as fresh_sitemap from "@elsoul/fresh-sitemap";
Add Package
pnpm dlx jsr add @elsoul/fresh-sitemap
Import symbol
import * as fresh_sitemap from "@elsoul/fresh-sitemap";
Add Package
bunx jsr add @elsoul/fresh-sitemap
Import symbol
import * as fresh_sitemap from "@elsoul/fresh-sitemap";