🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

@webstandard/sitemap

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@webstandard/sitemap

A standards-compliant generator for producing sitemap.xml files

latest
npmnpm
Version
2.0.1
Version published
Weekly downloads
4
-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

@webstandard/sitemap

Silent, precise, effective. No ghost routes. No false intel. Every URL accounted for.

Canonical URL:
https://alexstevovich.com/a/webstandard-sitemap-nodejs

Software URL:
https://midnightcitylights.com/software/webstandard-sitemap-nodejs

@webstandard/sitemap is a minimal, standards-compliant generator for producing sitemap.xml files in Node.js.
It provides clean classes for defining URLs, modification dates, and sitemap indexes — then outputs canonical XML exactly as search engines expect.

Installation

npm  install  @webstandard/sitemap

Example

import { SitemapXml, SitemapXmlUrl } from '@webstandard/sitemap';

// Create a sitemap instance
const sitemap = new SitemapXml();

// Add URLs
sitemap.addUrl(
    new SitemapXmlUrl('/', {
        priority: 1.0,
        changefreq: 'daily',
        lastmod: new Date('2024-02-20'),
    }),
);

sitemap.addUrl(
    new SitemapXmlUrl('/about', {
        priority: 0.8,
        changefreq: 'weekly',
        lastmod: new Date('2024-02-18'),
    }),
);

// Generate XML
const xml = sitemap.output({
    domain: 'https://example.com',
    dateFormat: 'date-only',
});
console.log(xml);

Working with Sitemap Indexes

import { SitemapXmlIndex, SitemapXmlIndexItem } from '@webstandard/sitemap';

const index = new SitemapXmlIndex();
index.addItem(
    new SitemapXmlIndexItem('/sitemap1.xml', {
        lastmod: new Date('2024-02-20'),
    }),
);
index.addItem(
    new SitemapXmlIndexItem('/sitemap2.xml', {
        lastmod: new Date('2024-02-18'),
    }),
);

const xml = index.output({
    domain: 'https://example.com',
    dateFormat: 'date-only',
});
console.log(xml);

JSON Serialization

Both SitemapXml and SitemapXmlIndex support full JSON serialization and rebuilding:

const json = sitemap.toJSON();
const restored = SitemapXml.fromJSON(json);

Need robots.txt?

I provide a package for robots.txt as well.

https://alexstevovich.com/a/webstandard-robots-nodejs

Ready to join the most elite Sitemap?

This package is also mirrored here: SitemapTeam6

License

Licensed under the Apache License 2.0.

Keywords

sitemap

FAQs

Package last updated on 12 Nov 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts