Skip to content

Commit 8282d5f

Browse files
committed
zrok redirects
1 parent 08bc47d commit 8282d5f

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

unified-doc/docusaurus.config.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,56 @@ console.log(" hotjar app : " + cfg.hotjar.id);
103103
console.log('REMARK_MAPPINGS:', JSON.stringify(REMARK_MAPPINGS, null, 2));
104104

105105

106+
function zrokRedirects(): PluginConfig {
107+
// Paths are relative to baseUrl.
108+
// Production (baseUrl='/docs/'): prefix = '/zrok'
109+
// Vercel preview (baseUrl='/'): prefix = '/docs/zrok'
110+
const p = (path: string) => isVercel ? `/docs/zrok${path}` : `/zrok${path}`;
111+
const redirects = [
112+
// getting-started → get-started
113+
{ to: '/get-started/', from: ['/getting-started'] },
114+
// category/guides → category/how-to-guides
115+
{ to: '/category/how-to-guides', from: ['/category/guides'] },
116+
// guides/* → how-tos/*
117+
{ to: '/how-tos/agent/', from: ['/guides/agent/'] },
118+
{ to: '/how-tos/agent/http-healthcheck', from: ['/guides/agent/http-healthcheck'] },
119+
{ to: '/how-tos/agent/linux-service', from: ['/guides/agent/linux-service'] },
120+
{ to: '/how-tos/agent/remoting', from: ['/guides/agent/remoting'] },
121+
{ to: '/how-tos/agent/windows-service/', from: ['/guides/agent/windows-service/'] },
122+
{ to: '/how-tos/docker-share/', from: ['/guides/docker-share/'] },
123+
{ to: '/how-tos/docker-share/private-share', from: ['/guides/docker-share/docker_private_share_guide'] },
124+
{ to: '/how-tos/docker-share/public-share', from: ['/guides/docker-share/docker_public_share_guide'] },
125+
{ to: '/how-tos/drives', from: ['/guides/drives'] },
126+
{ to: '/how-tos/frontdoor', from: ['/guides/frontdoor'] },
127+
{ to: '/how-tos/install/', from: ['/guides/install/'] },
128+
{ to: '/how-tos/install/linux', from: ['/guides/install/linux'] },
129+
{ to: '/how-tos/install/macos', from: ['/guides/install/macos'] },
130+
{ to: '/how-tos/install/windows', from: ['/guides/install/windows'] },
131+
{ to: '/how-tos/permission-modes', from: ['/guides/permission-modes'] },
132+
{ to: '/how-tos/v2-migration-guide', from: ['/guides/v2-migration-guide'] },
133+
{ to: '/how-tos/vpn', from: ['/guides/vpn'] },
134+
// guides/self-hosting/* → self-hosting/*
135+
{ to: '/self-hosting/docker', from: ['/guides/self-hosting/docker'] },
136+
{ to: '/self-hosting/dynamic-proxy', from: ['/guides/self-hosting/dynamicProxy'] },
137+
{ to: '/self-hosting/error-pages', from: ['/guides/self-hosting/error-pages'] },
138+
{ to: '/self-hosting/instance-configuration', from: ['/guides/self-hosting/instance-configuration'] },
139+
{ to: '/self-hosting/interstitial-page', from: ['/guides/self-hosting/interstitial-page'] },
140+
{ to: '/self-hosting/kubernetes', from: ['/guides/self-hosting/kubernetes'] },
141+
{ to: '/self-hosting/linux/', from: ['/guides/self-hosting/self_hosting_guide', '/guides/self-hosting/linux'] },
142+
{ to: '/self-hosting/linux/nginx', from: ['/guides/self-hosting/nginx_tls_guide/', '/guides/self-hosting/linux/nginx'] },
143+
{ to: '/self-hosting/metrics-and-limits/configuring-limits', from: ['/guides/metrics-and-limits/configuring-limits', '/guides/self-hosting/metrics-and-limits/configuring-limits'] },
144+
{ to: '/self-hosting/metrics-and-limits/configuring-metrics', from: ['/guides/metrics-and-limits/configuring-metrics', '/guides/self-hosting/metrics-and-limits/configuring-metrics'] },
145+
{ to: '/self-hosting/oauth/configuring-oauth', from: ['/guides/self-hosting/oauth/configuring-oauth'] },
146+
{ to: '/self-hosting/oauth/integrations/github', from: ['/guides/self-hosting/oauth/integrations/github'] },
147+
{ to: '/self-hosting/oauth/integrations/google', from: ['/guides/self-hosting/oauth/integrations/google'] },
148+
{ to: '/self-hosting/oauth/integrations/oidc', from: ['/guides/self-hosting/oauth/integrations/oidc'] },
149+
{ to: '/self-hosting/organizations', from: ['/guides/self-hosting/organizations'] },
150+
{ to: '/self-hosting/personalized-frontend', from: ['/guides/self-hosting/personalized-frontend'] },
151+
{ to: '/self-hosting/self-service-invite', from: ['/guides/self-hosting/self-service-invite'] },
152+
].map(({ to, from }) => ({ to: p(to), from: from.map(f => p(f)) }));
153+
return ['@docusaurus/plugin-client-redirects', { redirects }];
154+
}
155+
106156
function extendDocsPlugins(plugin: PluginConfig): PluginConfig {
107157
if (!Array.isArray(plugin)) return plugin;
108158

@@ -351,6 +401,7 @@ const config: Config = {
351401
[pluginHotjar, {}],
352402
['@docusaurus/plugin-google-tag-manager', {id: `openziti-gtm`, containerId: cfg.google.tag}],
353403
build(BUILD_FLAGS.SELFHOSTED) && onpremRedirects(routeBase('selfhosted')),
404+
build(BUILD_FLAGS.ZROK) && zrokRedirects(),
354405
].filter(Boolean),
355406
themeConfig: {
356407
docs: {

0 commit comments

Comments
 (0)