Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,5 +148,6 @@ module.exports = {
plugins: [
['@vuepress/google-analytics', { ga: 'UA-74284223-1' }],
['sitemap', { hostname: 'https://grapesjs.com' }],
['./plugins/sitemap-index'],
],
};
31 changes: 31 additions & 0 deletions docs/.vuepress/plugins/sitemap-index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
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}`);
},
};
};
5 changes: 5 additions & 0 deletions docs/.vuepress/public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
User-agent: *
Allow: /

Sitemap: https://grapesjs.com/docs/sitemap-index.xml