Relocate the ~6k-file docs tree from the repo root into plugins/document-navigator/docs/ so the plugin is self-contained and portable. docs/superpowers/ (specs and plans) stays at the repo root. Moved via cp+rm rather than git mv because directory rename() fails with EPERM on this WSL /mnt DrvFs mount; git rename-detection pairs the identical-content files at commit time. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
7.7 KiB
7.7 KiB
@suaveplan/sitemap - Sitemap generation and parsing: sitemap.xml, sitemap index, image sitemaps, video sitemaps per sitemaps.org protocol
Summary
Sitemap generation and parsing for the sitemaps.org XML protocol. Produces valid sitemap.xml, sitemap index documents, and parses existing sitemaps. Supports Google image and video extensions as well as hreflang alternate links.
Documentation tree
- builder — (no submodules)
- sitemap-builder — (no submodules)
- index-builder — (no submodules)
- index-builder — (no submodules)
- parser — (no submodules)
- sitemap-parser — (no submodules)
- errors — (no submodules)
- sitemap-error — (no submodules)
- schemas — (no submodules)
- sitemap.schema — (no submodules)
- utils — (no submodules)
- url-utils — (no submodules)
Installation
bun add @suaveplan/sitemap
Packages
| Module | Purpose |
|---|---|
| sitemap-builder | Fluent builder for <urlset> sitemap documents |
| index-builder | Fluent builder for <sitemapindex> documents |
| sitemap-parser | Parse sitemap and sitemap index XML strings |
| url-utils | URL validation, normalisation, XML escaping |
| sitemap.schema | Zod schemas for all wire-format types |
| sitemap-error | Error codes and SitemapError class |
Quick Start
import { createSitemap, createSitemapIndex, parseSitemap } from "@suaveplan/sitemap";
// Build a sitemap
const xml = createSitemap({ pretty: true })
.add({ loc: "https://example.com/", changefreq: "weekly", priority: 1.0 })
.add({ loc: "https://example.com/about", lastmod: "2024-01-15" })
.build();
// Build a sitemap index
const indexXml = createSitemapIndex({ pretty: true })
.add("https://example.com/sitemap-blog.xml", "2024-06-01")
.add("https://example.com/sitemap-products.xml")
.build();
// Parse an existing sitemap
const urls = parseSitemap(xml);
console.log(urls[0].loc); // "https://example.com/"
Subpath Exports
import { SitemapBuilder, createSitemap } from "@suaveplan/sitemap/builder";
import { SitemapIndexBuilder, createSitemapIndex } from "@suaveplan/sitemap/index-builder";
import { parseSitemap, parseSitemapIndex } from "@suaveplan/sitemap/parser";
import { SitemapError, SITEMAP_CODES } from "@suaveplan/sitemap/errors";