Skip to main content

Built and signed on GitHub Actions

This plugin generates a sitemap for a Deno Fresh v2 project.

This package works with Deno, BrowsersIt is unknown whether this package works with Cloudflare Workers, Node.js, Bun
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
This package works with Deno
It is unknown whether this package works with Bun
This package works with Browsers
JSR Score
100%
Published
a month ago (1.3.1)

Fresh Sitemap Plugin

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.

Features

  • Automatic Sitemap Generation: Scans the routes and articles 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.

Installation and Usage

  1. Install the Plugin

    Import the functions from the module to use within your Fresh project.

    import { saveSitemap } from 'jsr:@elsoul/fresh-sitemap'
    
  2. 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.

Contributing

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.

License

The package is available as open source under the terms of the Apache-2.0 License.

Code of Conduct

Everyone interacting in the SKEET project’s codebases, issue trackers, chat rooms, and mailing lists is expected to follow the code of conduct.

Built and signed on
GitHub Actions
View transparency log

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";