Free and Open source Web Builder Framework. Next generation tool for building templates without coding
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

28 lines
873 B

const fs = require('fs');
const path = require('path');
module.exports = (options, context) => {
return {
generated() {
const sitemapIndexPath = path.resolve(context.outDir || options.dest, 'sitemap-index.xml');
const sitemaps = [
'https://grapesjs.com/sitemap.xml',
'https://grapesjs.com/docs/sitemap.xml',
'https://app.grapesjs.com/sitemap.xml',
];
const now = new Date().toISOString();
const sitemapIndexXml = `<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
${sitemaps.map(sitemap => ` <sitemap>
<loc>${sitemap}</loc>
<lastmod>${now}</lastmod>
</sitemap>`).join('\n')}
</sitemapindex>`;
fs.writeFileSync(sitemapIndexPath, sitemapIndexXml);
console.log(`\n✅ Sitemap index generated at ${sitemapIndexPath}`);
},
};
};