mirror of https://github.com/artf/grapesjs.git
3 changed files with 34 additions and 0 deletions
@ -0,0 +1,28 @@ |
|||||
|
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}`); |
||||
|
}, |
||||
|
}; |
||||
|
}; |
||||
|
|
||||
@ -0,0 +1,5 @@ |
|||||
|
User-agent: * |
||||
|
Allow: / |
||||
|
|
||||
|
Sitemap: https://grapesjs.com/docs/sitemap-index.xml |
||||
|
|
||||
Loading…
Reference in new issue