From fee85f0234b1efbdb548b02f766a2c3ceb83d192 Mon Sep 17 00:00:00 2001 From: Mark Danial Date: Fri, 14 Nov 2025 09:06:48 -0800 Subject: [PATCH 1/2] GRA-164: updates sitemap build step --- docs/.vuepress/config.js | 1 + docs/.vuepress/plugins/sitemap-index.js | 28 +++++++++++++++++++++++++ docs/.vuepress/public/robots.txt | 5 +++++ 3 files changed, 34 insertions(+) create mode 100644 docs/.vuepress/plugins/sitemap-index.js create mode 100644 docs/.vuepress/public/robots.txt diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 8c8da4074d..c4cc58a182 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -148,5 +148,6 @@ module.exports = { plugins: [ ['@vuepress/google-analytics', { ga: 'UA-74284223-1' }], ['sitemap', { hostname: 'https://grapesjs.com' }], + ['./plugins/sitemap-index'], ], }; diff --git a/docs/.vuepress/plugins/sitemap-index.js b/docs/.vuepress/plugins/sitemap-index.js new file mode 100644 index 0000000000..b1671ce744 --- /dev/null +++ b/docs/.vuepress/plugins/sitemap-index.js @@ -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 = ` + +${sitemaps.map(sitemap => ` + ${sitemap} + ${now} + `).join('\n')} +`; + + fs.writeFileSync(sitemapIndexPath, sitemapIndexXml); + console.log(`\n✅ Sitemap index generated at ${sitemapIndexPath}`); + }, + }; +}; + diff --git a/docs/.vuepress/public/robots.txt b/docs/.vuepress/public/robots.txt new file mode 100644 index 0000000000..47fe73182c --- /dev/null +++ b/docs/.vuepress/public/robots.txt @@ -0,0 +1,5 @@ +User-agent: * +Allow: / + +Sitemap: https://grapesjs.com/docs/sitemap-index.xml + From cd2ed7717c43e9c768294d9d9c331e8bc0596e50 Mon Sep 17 00:00:00 2001 From: Mark Danial Date: Fri, 14 Nov 2025 09:11:52 -0800 Subject: [PATCH 2/2] fix: formatting --- docs/.vuepress/plugins/sitemap-index.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/.vuepress/plugins/sitemap-index.js b/docs/.vuepress/plugins/sitemap-index.js index b1671ce744..6a31d3af24 100644 --- a/docs/.vuepress/plugins/sitemap-index.js +++ b/docs/.vuepress/plugins/sitemap-index.js @@ -14,10 +14,14 @@ module.exports = (options, context) => { const now = new Date().toISOString(); const sitemapIndexXml = ` -${sitemaps.map(sitemap => ` +${sitemaps + .map( + (sitemap) => ` ${sitemap} ${now} - `).join('\n')} + `, + ) + .join('\n')} `; fs.writeFileSync(sitemapIndexPath, sitemapIndexXml); @@ -25,4 +29,3 @@ ${sitemaps.map(sitemap => ` }, }; }; -