@zeropress/build-core 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/api/build-site.js +4 -16
package/package.json
CHANGED
package/src/api/build-site.js
CHANGED
|
@@ -1047,7 +1047,6 @@ function buildSitemapXml(site, emitted, generatedAt) {
|
|
|
1047
1047
|
.filter((route) => route.url === '/')
|
|
1048
1048
|
.map((route) => ({
|
|
1049
1049
|
url: route.url,
|
|
1050
|
-
lastmod: generatedAt,
|
|
1051
1050
|
changefreq: 'daily',
|
|
1052
1051
|
priority: 1.0,
|
|
1053
1052
|
})),
|
|
@@ -1059,28 +1058,17 @@ function buildSitemapXml(site, emitted, generatedAt) {
|
|
|
1059
1058
|
})),
|
|
1060
1059
|
...emitted.pages.map((page) => ({
|
|
1061
1060
|
url: page.url,
|
|
1062
|
-
lastmod: generatedAt,
|
|
1063
1061
|
changefreq: 'monthly',
|
|
1064
1062
|
priority: 0.7,
|
|
1065
1063
|
})),
|
|
1066
|
-
...emitted.categoryRoutes.filter((route) => route.page === 1).map((route) => ({
|
|
1067
|
-
url: route.url,
|
|
1068
|
-
lastmod: generatedAt,
|
|
1069
|
-
changefreq: 'weekly',
|
|
1070
|
-
priority: 0.6,
|
|
1071
|
-
})),
|
|
1072
|
-
...emitted.tagRoutes.filter((route) => route.page === 1).map((route) => ({
|
|
1073
|
-
url: route.url,
|
|
1074
|
-
lastmod: generatedAt,
|
|
1075
|
-
changefreq: 'weekly',
|
|
1076
|
-
priority: 0.5,
|
|
1077
|
-
})),
|
|
1078
1064
|
];
|
|
1079
1065
|
|
|
1080
1066
|
const body = entries.map((entry) => {
|
|
1081
1067
|
const loc = escapeXml(resolveSiteUrl(site.url, entry.url));
|
|
1082
|
-
const lastmod = entry.lastmod
|
|
1083
|
-
|
|
1068
|
+
const lastmod = entry.lastmod
|
|
1069
|
+
? `\n <lastmod>${entry.lastmod.toISOString()}</lastmod>`
|
|
1070
|
+
: '';
|
|
1071
|
+
return ` <url>\n <loc>${loc}</loc>${lastmod}\n <changefreq>${entry.changefreq}</changefreq>\n <priority>${entry.priority.toFixed(1)}</priority>\n </url>`;
|
|
1084
1072
|
}).join('\n');
|
|
1085
1073
|
|
|
1086
1074
|
return `<?xml version="1.0" encoding="UTF-8"?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n${body}\n</urlset>`;
|