If you're looking for a easy to use sitemap renderer and don't need extra features like extended sitemap or sitemap index files, this library might be helpful.
💻 Installation
$ npm i simple-sitemap-renderer
or
yarn add simple-sitemap-renderer
🎈 Usage
import { renderSitemap } from 'simple-sitemap-renderer'
renderSitemap([
{
url: 'https://your-site/your-page-1',
lastmod: '2020-10-10',
changefreq: 'always',
priority: 0.8,
},
{
url: 'https://your-site/your-page-2',
lastmod: '2020-10-10',
},
{
url: 'https://your-site/your-page-3',
},
])
Rendered Result
the sample here is formatted for readability, but actual result will always be minified.
<?xml version="1.0" encoding="UTF-8"?>
<urlset>
<url>
<loc>https://your-site/your-page-1</loc>
<lastmod>2020-10-10</lastmod>
<changefreq>always</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>https://your-site/your-page-2</loc>
<lastmod>2020-10-10</lastmod>
</url>
<url>
<loc>https://your-site/your-page-3</loc>
</url>
</urlset>
More info
tars0x9752 / simple-sitemap-renderer
A bare minimum sitemap renderer written in TypeScript.
simple-sitemap-renderer
A bare minimum sitemap renderer written in TypeScript.
Features
- Render standard sitemap XML
- Zero-dependencies
- Written in TypeScript
💻 Installation
$ npm i simple-sitemap-renderer
or
yarn add simple-sitemap-renderer
🎈 Usage
import { renderSitemap } from 'simple-sitemap-renderer'
renderSitemap([
{
url: 'https://your-site/your-page-1',
lastmod: '2020-10-10',
changefreq: 'always',
priority: 0.8,
},
{
url: 'https://your-site/your-page-2',
lastmod: '2020-10-10',
},
{
url: 'https://your-site/your-page-3',
},
])
Rendered Result
the sample here is formatted for readability, but actual result will always be minified.
<?xml version="1.0" encoding="UTF-8"?>
<urlset>
<url>
<loc>https://your-site/your-page-1</loc>
<lastmod>2020-10-10</lastmod>
<changefreq>always</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>https://your-site/your-page-2</loc>
<lastmod>2020-10-10</lastmod>
</
…
Top comments (0)