Skip to content

Commit 8cc3545

Browse files
authored
Update generate-sitemap.js
1 parent 178b089 commit 8cc3545

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

generate-sitemap.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,17 @@ function getAllFiles(dirPath, arrayOfFiles) {
2121
return arrayOfFiles;
2222
}
2323

24-
// Generate sitemap.xml content
24+
// Generate sitemap.xml content with lastmod and priority
2525
function generateSitemap(files) {
2626
let xml = '<?xml version="1.0" encoding="UTF-8"?>\n';
2727
xml += '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n';
2828

2929
files.forEach(function(file) {
3030
const url = 'https://tg-nav.github.io/' + file.replace('./', ''); // Update URL as needed
31-
xml += `\t<url>\n\t\t<loc>${url}</loc>\n\t</url>\n`;
31+
const lastmod = new Date().toISOString().split('T')[0]; // Current date as lastmod
32+
const priority = 0.5; // Set priority as needed
33+
34+
xml += `\t<url>\n\t\t<loc>${url}</loc>\n\t\t<lastmod>${lastmod}</lastmod>\n\t\t<priority>${priority}</priority>\n\t</url>\n`;
3235
});
3336

3437
xml += '</urlset>';

0 commit comments

Comments
 (0)