Copilot commented on code in PR #2025:
URL: https://github.com/apache/apisix-website/pull/2025#discussion_r3076708220
##########
scripts/update-sitemap-loc.js:
##########
@@ -48,17 +48,62 @@ function shouldExclude(url) {
}
/**
- * Filter out excluded URLs from a sitemap object and return removal count.
+ * Determine the priority for a URL based on its path.
+ * Higher priority for key landing pages, lower for deep docs and archives.
+ */
+function getPriority(url) {
+ // Homepage
+ if (/^https:\/\/apisix\.apache\.org\/(zh\/)?$/.test(url)) return '1.0';
+ // Key landing pages
+ if (/\/(ai-gateway|plugins|downloads|docs|learning-center)\/$/.test(url))
return '0.8';
+ // Learning center articles and blog posts
+ if (/\/learning-center\//.test(url)) return '0.8';
+ if (/\/blog\/\d{4}\//.test(url)) return '0.6';
+ // Doc pages (latest version)
Review Comment:
`getPriority()` only assigns blog priority (0.6) to URLs matching
`/blog/<year>/...`, so the blog index (`/blog/`) and archive (`/blog/archive/`)
will fall back to the default 0.5 priority. If the intent is to treat all blog
pages as 0.6 (as described in the PR summary), broaden the blog match to
include non-year blog URLs that aren’t already excluded (e.g., index/archive)
while keeping tag/page URLs excluded.
##########
scripts/update-sitemap-loc.js:
##########
@@ -48,17 +48,62 @@ function shouldExclude(url) {
}
/**
- * Filter out excluded URLs from a sitemap object and return removal count.
+ * Determine the priority for a URL based on its path.
+ * Higher priority for key landing pages, lower for deep docs and archives.
+ */
+function getPriority(url) {
+ // Homepage
+ if (/^https:\/\/apisix\.apache\.org\/(zh\/)?$/.test(url)) return '1.0';
+ // Key landing pages
+ if (/\/(ai-gateway|plugins|downloads|docs|learning-center)\/$/.test(url))
return '0.8';
+ // Learning center articles and blog posts
+ if (/\/learning-center\//.test(url)) return '0.8';
+ if (/\/blog\/\d{4}\//.test(url)) return '0.6';
+ // Doc pages (latest version)
+ if (/\/docs\//.test(url)) return '0.7';
+ // Everything else
+ return '0.5';
+}
+
+/**
+ * Determine the changefreq for a URL based on its path.
+ */
+function getChangefreq(url) {
+ if (/^https:\/\/apisix\.apache\.org\/(zh\/)?$/.test(url)) return 'weekly';
+ if (/\/blog\/\d{4}\//.test(url)) return 'monthly';
+ if (/\/docs\//.test(url)) return 'monthly';
+ if (/\/learning-center\//.test(url)) return 'monthly';
+ return 'weekly';
Review Comment:
`getChangefreq()` sets blog URLs to `monthly` only when they match
`/blog/<year>/...`, which means the blog index (`/blog/`) and archive
(`/blog/archive/`) will default to `weekly`. If the goal is “monthly for
docs/blog” (per PR description), consider treating the blog index/archive as
`monthly` as well (excluding tag/page URLs already filtered out).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]