Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

docsify-sitemap

tenelabs222MIT1.1.0

Create structured, SEO-friendly sitemaps for your Docsify projects in seconds.

docsify, sitemap, sitemap generator, docsify sitemap, docsify plugin, SEO, generate sitemap, documentation sitemap, docs site SEO, docsify tool

readme

Docsify Sitemap Generator

Generate an SEO friendly sitemap.xml for your Docsify site in seconds.

This tool supports both local filesystem crawling and GitHub repository integration, giving you maximum flexibility.

Features

  • Local & GitHub: Crawl Markdown files locally or fetch from a GitHub repo.
  • Sitemap Standards: Generates a fully compliant sitemap.xml for optimal search engine indexing.
  • Rate Limit Friendly: Support for GitHub Personal Access Tokens (PAT) to avoid API throttling.
  • Customizable: Configure base directories, branches, output paths, and more.
  • Flexible Workflows: Use via CLI or Web UI choose what fits your pipeline.

Live Demo

Try it now without installing: Docsify Sitemap Generator Web UI

Preview

Image

Installation

Install as a development dependency:

npm install --save-dev docsify-sitemap
# or
yarn add --dev docsify-sitemap

Or globally:

npm install -g docsify-sitemap
# or
yarn global add docsify-sitemap

Quick Start

Run the CLI and follow prompts:

npx docsify-sitemap

You’ll be asked for your site URL, GitHub repo details (if applicable), and output location. A sitemap.xml file will be generated in your project.

CLI Usage

docsify-sitemap [command] [options]

Commands

Command Description
local Generate sitemap from local Markdown files

Global Options

Flag Description
-u, --url <url> (required) Website URL (e.g. https://user.github.io/repo)
-o, --owner <o> GitHub owner or organization (required for repo mode)
-r, --repo <r> GitHub repository name (required for repo mode)
-b, --base <dir> Base directory within repo or local path (default: .)
-B, --branch <b> Git branch (default: main)
-p, --pat <token> GitHub Personal Access Token for private repos or higher rate limit
-f, --output <f> Output path and filename (default: ./public/sitemap.xml)
-i, --ignore-dot-underscore Ignore files and folders starting with _ or . when generating sitemap
-h, --help Display help for commands
-V, --version Output the current version

Examples

Basic use

npx docsify-sitemap \
  -u https://user.github.io/repo \
  -o user \
  -r repo \
  -b docs \
  -p YOUR_GH_PAT \
  -f ./docs/sitemap.xml
  -i

Automated GitHub Action

name: Generate Sitemap

on:
  push:
    paths:
      - "**/*.md"
  workflow_dispatch:

permissions:
  contents: write

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
      - name: Generate sitemap
        run: npx docsify-sitemap local -u WEBSITE_URL
      - name: Commit sitemap
        run: |
          git config user.name 'github-actions[bot]'
          git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
          git add .
          git diff --cached --quiet || git commit -m 'chore: update sitemap.xml'
          git push

🔧 API & Options Reference

Option Type Default Description
url string Required. Site URL or GitHub Pages URL
owner string GitHub owner/org (for repo mode)
repo string Repository name (for repo mode)
branch string main Branch containing your Docsify site
base string . Base folder in repo or local filesystem
pat string GitHub PAT to increase rate limit
output string ./public/sitemap.xml Output file path
ignore-dot-underscore boolean false Ignore files and folders starting with _ or .

Contributing

  1. Fork the repository
  2. Create a branch: git checkout -b feature/your-feature
  3. Make your changes and test
  4. Submit a pull request

We welcome enhancements, bug fixes, and documentation improvements. Please follow existing code style and conventions.

License

This project is licensed under the MIT License.

changelog

Changelog

1.1.0 (2025-05-29)

Features

  • cli: add --ignore-dot-underscore flag and remove interactive mode (#3) (e55a5a6)

Bug Fixes

  • update OG and Twitter image URL for proper social media previews (a58d50c)

1.0.1 (2025-05-19)

1.0.0 (2025-05-19)

⚠ BREAKING CHANGES

  • release initial stable version of Docsify Sitemap Generator

Features

  • GitHub Repo Crawler: Automatically fetches all .md files from a GitHub repo.
  • Local Mode: Generate sitemap from local markdown files without GitHub.
  • Standards-compliant sitemap.xml: Fully SEO-friendly and valid.
  • Interactive CLI: Prompt-based user input for easy use.
  • Support for GitHub PAT: Avoid API rate limits with personal tokens.
  • Branch + Base Support: Target specific branches and subdirectories.
  • Configurable Output Path: Write sitemap anywhere (./public/sitemap.xml by default).
  • GitHub Workflow Ready: Easily integrate into CI/CD pipelines.
  • Web UI (Demo): Generate sitemap in the browser – no install needed.

  • release initial stable version of Docsify Sitemap Generator (8bc274a)