node-multi-sitemap
A sitemap module that is built to grow with multiple connected sitemaps
Good for if you want to keep your sitemaps organized into multiple individual sitemaps under an sitemap index file. See https://support.google.com/webmasters/answer/75712?hl=en&rd=1 for details
Installation
npm install node-multi-sitemap
Setup
Require and register your sitemap indexes
MultiSitemap = require'node-multi-sitemap' sitemapPath = '/path/to/sitemap' # path to dir where all your sitemaps live pages = 'products''blogs''events' siteURL = 'https://www.example-site.com'instance = siteURLsitemapPath # Register sitemap pages pagesforEachinstanceaddSitemap # Add pages to the sitemap instanceadd'blogs''blogs/20150225/some-path-of-a-blog-post'instanceadd'products''http://www.example-site.com/pid/40273' priority: 8changeFreq: 'monthly' setTimeout -> instanceflush # writes the new pages to disk. Creates the sitemap if it doesn't exist, otherwise appends
TODO
Currently this module expects you to already have a root sitemap index file, and be hooked up to use the sitemaps that your will be adding. For example the previous examples root sitemap would look like:
https://www.example-site.com/path/to/sitemap/products.xml https://www.example-site.com/path/to/sitemap/blogs.xml https://www.example-site.com/path/to/sitemap/events.xml
- Automatically generate the sitemap index XML file if it does not exist.
- Automatically update the last modified of the sitemaps in the index whenever a child sitemap is flushed/updated
- Does not currently support sitemap pages with more than 50,000 URLs