Skip to content

Commit

Permalink
Removing the trailing slash
Browse files Browse the repository at this point in the history
  • Loading branch information
amankumarrr committed Aug 23, 2024
1 parent 62c1a6e commit 2f7fffd
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions next-sitemap.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const fs = require('fs');
const path = require('path');
const fs = require("fs");
const path = require("path");

/** @type {import('next-sitemap').IConfig} */
module.exports = {
Expand Down Expand Up @@ -31,13 +31,17 @@ module.exports = {
return arrayOfFiles;
};

const newsletterUploadsDir = path.join(__dirname, 'public', 'images', 'newsletter-uploads');
const newsletterUploads = getAllFiles(newsletterUploadsDir).map(file => ({
loc: `/images/newsletter-uploads/${path.relative(newsletterUploadsDir, file).replace(/\\/g, '/')}`,
const newsletterUploadsDir = path.join(
__dirname,
"public",
"images",
"newsletter-uploads"
);
const newsletterUploads = getAllFiles(newsletterUploadsDir).map((file) => ({
loc: `/images/newsletter-uploads/${path.relative(newsletterUploadsDir, file).replace(/\\/g, "/")}`,
changefreq: "daily",
priority: 0.7,
lastmod: new Date().toISOString(),
trailingSlash: true,
}));

const otherURLsMapped = otherURLs.map((url) => ({
Expand All @@ -56,8 +60,7 @@ module.exports = {
loc: path.replace("/home", "/"),
changefreq: config.changefreq,
priority: 1.0,
lastmod: config.lastmod || new Date().
toISOString(),
lastmod: config.lastmod || new Date().toISOString(),
};
} else if (path.includes("/500") || path.includes("/404")) {
return null;
Expand Down

0 comments on commit 2f7fffd

Please sign in to comment.