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.
- Automatic Sitemap Generation: Scans the
routes
andarticles
directories for valid pages. - Multi-language Support: Specify an array of languages; the default language is included without a language prefix.
- Customizable Options: Choose to include/exclude files based on glob patterns and remove .html extensions if desired.
-
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 generatesitemap.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.