hexo-generator-sitemap is a Hexo plugin that generates standard sitemaps in XML and plain-text formats for static sites built with the Hexo framework.
What is hexo-generator-sitemap?
hexo-generator-sitemap is an open-source npm package maintained by the hexojs GitHub organization. It plugs directly into Hexo's build pipeline, reading your site's pages, posts, tags, and categories to produce sitemap.xml and sitemap.txt files in your public directory. The plugin is configured through a small block in _config.yml and requires no manual sitemap upkeep.
Key Features
- Dual format output — Generates both an XML sitemap (sitemap.xml) and a plain-text sitemap (sitemap.txt) by default, with paths configurable in _config.yml.
- Custom templates — Users can provide their own template files for both XML and TXT output via the template and template_txt options, with default templates shown in the repository.
- Tag and category inclusion — The tags and categories options add your site's tag and category pages to the sitemap when set to true.
- rel-sitemap support — Setting rel to true adds a rel-sitemap link to the site's HTML header for better crawler discovery.
- Per-post exclusion — Any post or page can be excluded by adding sitemap: false to its front matter.
- Versioned compatibility — The plugin tracks Hexo versions: 2.x works with Hexo 4, 1.x with Hexo 3, and 0.x with Hexo 2.
Who is it for?
- Hexo bloggers — Automatically keep search engines informed of all published posts without manually maintaining a sitemap.
- SEO specialists — Use custom templates and the rel-sitemap option to tailor sitemap markup to site-specific SEO needs.
- Static site developers — Quickly add sitemap generation to any Hexo project by installing a single npm package and adding a short config block.
How does hexo-generator-sitemap work?
Install the plugin with npm install hexo-generator-sitemap --save, add a sitemap block to your _config.yml, and rebuild your site. The plugin hooks into Hexo's generation pipeline and writes the sitemap files to your public directory. Exclusions are handled by reading each post/page's front matter for a sitemap: false flag.
FAQ
How do I install hexo-generator-sitemap?
Run npm install hexo-generator-sitemap --save in your Hexo project directory. The plugin version should match your Hexo version: 2.x for Hexo 4, 1.x for Hexo 3, and 0.x for Hexo 2.
Can I generate more than one sitemap file?
Yes. The path option accepts an array of paths, so you can set path to both sitemap.xml and sitemap.txt to output both formats, or provide any other file names you need.
How do I exclude a specific post from the sitemap?
Add sitemap: false to the post's front matter. For example, set title, date, and sitemap: false in the YAML block. The plugin will skip that post when generating the sitemap.
Does hexo-generator-sitemap support tags and categories?
Yes. Set tags: true and categories: true in the sitemap config block to include your site's tag and category pages. Both options are off by default.
Is hexo-generator-sitemap free?
Yes. It is an open-source plugin distributed via npm, so you can install and use it at no cost.








