From 828260303312e3c569a86eb868a18aa5edcc9cef Mon Sep 17 00:00:00 2001 From: Paul Gottschling Date: Mon, 9 Sep 2024 09:56:51 -0400 Subject: [PATCH] [v14] Remove `/ver/` segments from Web UI docs links (#45506) * Remove `/ver/` segments from Web UI docs links Backports #45474 The Support component is the only Web UI component that renders docs links that include the `/ver/` path segment. This change removes the `/ver/` path segment from these links so they point to the default version of the docs. The user can use the version dropdown within the docs site to adjust the version. This change does not alter UTM parameters. With this change, we only need to manage redirects in the default version of the docs site. This makes it less likely that users will encounter 404 errors. And since the docs site only displays the current version and previous two versions, link targets with the `/ver/` segment will 404 in EOL Teleport versions. This change also prevents that scenario. * Update snapshots --- web/packages/teleport/src/Support/Support.tsx | 20 ++------ .../__snapshots__/Support.story.test.tsx.snap | 50 +++++++++---------- 2 files changed, 30 insertions(+), 40 deletions(-) diff --git a/web/packages/teleport/src/Support/Support.tsx b/web/packages/teleport/src/Support/Support.tsx index 3c8e78cd2fe39..f38676a28cc43 100644 --- a/web/packages/teleport/src/Support/Support.tsx +++ b/web/packages/teleport/src/Support/Support.tsx @@ -169,23 +169,13 @@ const getDocUrls = (version = '', isEnterprise: boolean) => { const withUTM = (url = '', anchorHash = '') => `${url}?product=teleport&version=${verPrefix}_${version}${anchorHash}`; - let docVer = ''; - if (version && version.length > 0) { - const major = version.split('.')[0]; - docVer = `/ver/${major}.x`; - } - return { - getStarted: withUTM(`https://goteleport.com/docs${docVer}/getting-started`), - tshGuide: withUTM( - `https://goteleport.com/docs${docVer}/server-access/guides/tsh` - ), - adminGuide: withUTM( - `https://goteleport.com/docs${docVer}/management/admin/` - ), - faq: withUTM(`https://goteleport.com/docs${docVer}/faq`), + getStarted: withUTM(`https://goteleport.com/docs/get-started/`), + tshGuide: withUTM(`https://goteleport.com/docs/connect-your-client/tsh/`), + adminGuide: withUTM(`https://goteleport.com/docs/management/admin/`), + faq: withUTM(`https://goteleport.com/docs/faq`), troubleshooting: withUTM( - `https://goteleport.com/docs${docVer}/management/admin/troubleshooting/` + `https://goteleport.com/docs/management/admin/troubleshooting/` ), // there isn't a version-specific changelog page diff --git a/web/packages/teleport/src/Support/__snapshots__/Support.story.test.tsx.snap b/web/packages/teleport/src/Support/__snapshots__/Support.story.test.tsx.snap index 74c3720eacefa..d173d07c6b6fd 100644 --- a/web/packages/teleport/src/Support/__snapshots__/Support.story.test.tsx.snap +++ b/web/packages/teleport/src/Support/__snapshots__/Support.story.test.tsx.snap @@ -229,7 +229,7 @@ exports[`support Cloud 1`] = ` @@ -237,7 +237,7 @@ exports[`support Cloud 1`] = ` @@ -245,7 +245,7 @@ exports[`support Cloud 1`] = ` @@ -260,7 +260,7 @@ exports[`support Cloud 1`] = ` @@ -296,7 +296,7 @@ exports[`support Cloud 1`] = ` @@ -655,7 +655,7 @@ exports[`support Enterprise 1`] = ` @@ -663,7 +663,7 @@ exports[`support Enterprise 1`] = ` @@ -671,7 +671,7 @@ exports[`support Enterprise 1`] = ` @@ -687,7 +687,7 @@ exports[`support Enterprise 1`] = ` @@ -723,7 +723,7 @@ exports[`support Enterprise 1`] = ` @@ -1163,7 +1163,7 @@ exports[`support Enterprise with CTA 1`] = ` @@ -1171,7 +1171,7 @@ exports[`support Enterprise with CTA 1`] = ` @@ -1179,7 +1179,7 @@ exports[`support Enterprise with CTA 1`] = ` @@ -1195,7 +1195,7 @@ exports[`support Enterprise with CTA 1`] = ` @@ -1231,7 +1231,7 @@ exports[`support Enterprise with CTA 1`] = ` @@ -1582,7 +1582,7 @@ exports[`support OSS 1`] = ` @@ -1590,7 +1590,7 @@ exports[`support OSS 1`] = ` @@ -1598,7 +1598,7 @@ exports[`support OSS 1`] = ` @@ -1614,7 +1614,7 @@ exports[`support OSS 1`] = ` @@ -1650,7 +1650,7 @@ exports[`support OSS 1`] = ` @@ -2090,7 +2090,7 @@ exports[`support OSSWithCTA 1`] = ` @@ -2098,7 +2098,7 @@ exports[`support OSSWithCTA 1`] = ` @@ -2106,7 +2106,7 @@ exports[`support OSSWithCTA 1`] = ` @@ -2122,7 +2122,7 @@ exports[`support OSSWithCTA 1`] = ` @@ -2158,7 +2158,7 @@ exports[`support OSSWithCTA 1`] = `