Created
March 19, 2021 17:40
-
-
Save mike-casas/22d11e63052892cf99f80702f6739d21 to your computer and use it in GitHub Desktop.
sitemap diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Sitemapper = require('sitemapper'); | |
(async () => { | |
const sitemap = new Sitemapper(); | |
const oldSiteMapXml = await sitemap.fetch( | |
'https://auth0.com/blog/sitemap.xml', | |
); | |
const newSiteMapXml = await sitemap.fetch( | |
'http://localhost:3000/blog/sitemap.xml', | |
); | |
const intersection = oldSiteMapXml.sites.filter((x) => | |
newSiteMapXml.sites.includes(x), | |
); | |
const diff = oldSiteMapXml.sites.filter( | |
(x) => !newSiteMapXml.sites.includes(x), | |
); | |
console.log(`New Sitemap ${newSiteMapXml.sites.length}`); | |
console.log(`Old Sitemap ${oldSiteMapXml.sites.length}`); | |
console.log(`Sitemap intersection ${intersection.length}`); | |
console.log(`Sitemap diff ${diff.length}`); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment