Last active
July 16, 2018 08:52
-
-
Save wizardnet972/5099522baf69cd8210d384417ab012ff to your computer and use it in GitHub Desktop.
This file contains hidden or 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 path = require("path"); | |
| const fs = require("fs"); | |
| const _ = require("lodash"); | |
| const config = require("./crwl-config.json"); | |
| const Url = require("url"); | |
| const moment = require('moment'); | |
| module.exports.generate = urls => { | |
| var uris = urls.map(url => { | |
| return `<url> | |
| <loc>${url}</loc> | |
| <lastmod>${moment().format('YYYY-MM-DD')}</lastmod> | |
| <changefreq>daily</changefreq> | |
| <priority>0.8</priority> | |
| </url>`; | |
| }); | |
| return `<?xml version="1.0" encoding="UTF-8"?> | |
| <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> | |
| ${uris.join(" ")} | |
| </urlset>`; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment