RunKit + npm: sitemap

node v10.24.1
endpointsharetweet
const assert = require("assert"); const Sitemap = require("sitemap@1.12.0"); const blogpostUrls = ["/blog/first", "/blog/second"]; const sitemap = Sitemap.createSitemap({ hostname: "https://google.com" }); //add locations blogpostUrls.forEach(url => sitemap.add({url})); //generate xml with the two urls above const xmlBeforeDel = sitemap.toXML(); //delete locations blogpostUrls.forEach(url => sitemap.del(url)); //clearCache, for good measure sitemap.clearCache(); //generate xml again const xmlAfterDel = sitemap.toString(); //should not be equal //NOTE: this throws assert.notEqual(xmlBeforeDel, xmlAfterDel);
Created from: https://npm.runkit.com/sitemap
Loading…