Sphido logo

@sphido/sitemap

Install

yarn add @sphido/sitemap

Example

const {outputFile} = require('fs-extra');
const sitemap = require('@sphido/sitemap');

const posts = [
    {link: 'https://example.com/first', date: new Date()},
    {link: 'https://example.com/second', date: new Date()},
];

(async () => {
    await outputFile(
        __dirname  + '/sitemap.xml',
        sitemap(posts, 'https://example.com')
    );
})();

Source codes

https://github.com/sphido/sphido/tree/master/packages/sphido-sitemap