From a350b4ef93f7c863fce9892dd1537d1e0833fc23 Mon Sep 17 00:00:00 2001 From: manya706 Date: Fri, 11 Oct 2024 11:55:09 +0000 Subject: [PATCH] Prettified Code! --- scripts/generate-sitemap.mjs | 74 +++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 35 deletions(-) diff --git a/scripts/generate-sitemap.mjs b/scripts/generate-sitemap.mjs index 7dcb4e2e..744ee296 100644 --- a/scripts/generate-sitemap.mjs +++ b/scripts/generate-sitemap.mjs @@ -6,50 +6,54 @@ const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); function sitemap() { - return [ - { - url: 'https://virtualcoffee.io', - lastModified: new Date(), - changeFrequency: 'yearly', - priority: 1, - }, - { - url: 'https://virtualcoffee.io/about', - lastModified: new Date(), - changeFrequency: 'monthly', - priority: 0.8, - }, - { - url: 'https://virtualcoffee.io/events', - lastModified: new Date(), - changeFrequency: 'weekly', - priority: 0.6, - }, - { - url: 'https://virtualcoffee.io/podcast', - lastModified: new Date(), - changeFrequency: 'monthly', - priority: 0.7, - }, - { - url: 'https://virtualcoffee.io/contact', - lastModified: new Date(), - changeFrequency: 'yearly', - priority: 0.4, - }, - ] + return [ + { + url: 'https://virtualcoffee.io', + lastModified: new Date(), + changeFrequency: 'yearly', + priority: 1, + }, + { + url: 'https://virtualcoffee.io/about', + lastModified: new Date(), + changeFrequency: 'monthly', + priority: 0.8, + }, + { + url: 'https://virtualcoffee.io/events', + lastModified: new Date(), + changeFrequency: 'weekly', + priority: 0.6, + }, + { + url: 'https://virtualcoffee.io/podcast', + lastModified: new Date(), + changeFrequency: 'monthly', + priority: 0.7, + }, + { + url: 'https://virtualcoffee.io/contact', + lastModified: new Date(), + changeFrequency: 'yearly', + priority: 0.4, + }, + ]; } console.log('Generating sitemap...'); -const sitemapContent = sitemap().map(entry => ` +const sitemapContent = sitemap() + .map( + (entry) => ` ${entry.url} ${entry.lastModified.toISOString()} ${entry.changeFrequency} ${entry.priority} -`).join(''); +`, + ) + .join(''); const sitemapXml = ` @@ -58,4 +62,4 @@ const sitemapXml = ` const outputPath = path.join(__dirname, '../public/sitemap.xml'); fs.writeFileSync(outputPath, sitemapXml, 'utf8'); -console.log(`Sitemap generated successfully at ${outputPath}`); \ No newline at end of file +console.log(`Sitemap generated successfully at ${outputPath}`);