Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -310,4 +310,5 @@ RedirectMatch 301 "^(/zh)?/docs/apisix/en/latest/deployment-modes(\.md)?/?$" "$1
# and a self-referential canonical, so 18 near-duplicates competed with the
# pages they duplicated. The listing at /zh/learning-center/ now links to the
# English articles directly; these URLs are indexed, so send them there.
RedirectMatch 301 "^/zh/learning-center/(.+)$" "/learning-center/$1"
# DirectoryIndex resolves the listing through index.html; leave that file alone.
RedirectMatch 301 "^/zh/learning-center/(?!index\.html$)(.+)$" "/learning-center/$1"
12 changes: 12 additions & 0 deletions next/scripts/check-ingress-redirects.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ const directRedirects = [
'/docs/ingress-controller/1.8.0/FAQ/',
'/docs/ingress-controller/overview/',
],
[
'/docs/ingress-controller/FAQ/',
'/docs/ingress-controller/overview/',
],
[
'/docs/ingress-controller/reference/apisix-ingress-controller/crd-reference/',
'/docs/ingress-controller/reference/apisix-ingress-controller/api-reference/',
Expand Down Expand Up @@ -187,4 +191,12 @@ assert.equal(
'Redirect directives should only match complete path segments',
);

for (const listingPath of ['/zh/learning-center/', '/zh/learning-center/index.html']) {
assert.equal(firstRedirect(listingPath), null, `${listingPath} should remain a Chinese listing`);
}
assert.deepEqual(firstRedirect('/zh/learning-center/what-is-an-api-gateway/'), {
status: 301,
destination: '/learning-center/what-is-an-api-gateway/',
});

console.log(`Validated ${directRedirects.length} direct documentation redirects.`);
2 changes: 2 additions & 0 deletions next/scripts/generate-sitemaps.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ const excludePatterns = [
/^\/(?:zh\/)?docs\/[\w-]+\/(?:[\w-]+-)?\d+\.\d+(?:\.\d+)?\//,
/^\/(?:zh\/)?docs\/[\w./-]+\/tags\//,
/^\/(?:zh\/)?docs\/[\w-]+\/next\//,
// The current Ingress FAQ is a 301 alias for the overview, not an indexable page.
/^\/(?:zh\/)?docs\/ingress-controller\/FAQ\/$/,
/^\/(?:zh\/)?search\/?$/,
/^\/(?:zh\/)?blog\/(?:tags|page|archive)\//,
/^\/(?:zh\/)?learning-center\/(?:tags|page|archive)\//,
Expand Down
4 changes: 4 additions & 0 deletions next/scripts/generate-sitemaps.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const pages = [
'docs/apisix/next/plugins/cors',
'docs/apisix/tags/plugins',
'docs/apisix/upgrade-guide-from-2.15.x-to-3.0.0',
'docs/ingress-controller/FAQ',
'search',
'zh',
'zh/learning-center',
Expand All @@ -75,6 +76,7 @@ const pages = [
'zh/blog/page/2',
'zh/blog/2026/07/28/bi-weekly report',
'zh/docs/ingress-controller/2.1.0/overview',
'zh/docs/ingress-controller/FAQ',
'zh/docs/apisix/next/plugins/cors',
'zh/docs/apisix/tags/plugins',
'zh/search',
Expand Down Expand Up @@ -120,8 +122,10 @@ try {
'docs/docker/apisix-3.17.0/build',
'docs/apisix/next',
'docs/apisix/next/plugins/cors',
'docs/ingress-controller/FAQ',
'docs/apisix/tags/plugins',
'zh/docs/ingress-controller/2.1.0/overview',
'zh/docs/ingress-controller/FAQ',
'zh/docs/apisix/next/plugins/cors',
'zh/docs/apisix/tags/plugins',
'/search/',
Expand Down
Loading