very-simple-sitemap-generator
v0.1.0
Published
Very simple sitemap generator.
Downloads
114
Maintainers
Readme
very-simple-sitemap-generator
Very simple sitemap generator.
Install
npm i very-simple-sitemap-generator
# or
yarn add very-simple-sitemap-generator
Usage
import generateSitemap from 'very-simple-sitemap-generator';
const sitemap = generateSitemap([
'https://example.com',
'https://example.com/test1',
'https://example.com/test2',
]);
console.log(sitemap); // ↓↓↓
/*
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>
https://example.com
</loc>
</url>
<url>
<loc>
https://example.com/test1
</loc>
</url>
<url>
<loc>
https://example.com/test2
</loc>
</url>
</urlset>
*/
Node.js
const generateSitemap = require('very-simple-sitemap-generator').default;
const sitemap = generateSitemap([
'https://example.com',
'https://example.com/test1',
'https://example.com/test2',
]);
console.log(sitemap); // ↓↓↓
/*
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>
https://example.com
</loc>
</url>
<url>
<loc>
https://example.com/test1
</loc>
</url>
<url>
<loc>
https://example.com/test2
</loc>
</url>
</urlset>
*/
Development
# test
npm run test
# code format
npm run fmt