MCPcopy Index your code
hub / github.com/coder/coder / defaultDocsUrl

Function defaultDocsUrl

site/src/utils/docs.ts:3–19  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1import { getStaticBuildInfo } from "./buildInfo";
2
3function defaultDocsUrl(): string {
4 const docsUrl = "https://coder.com/docs";
5 // If we can get the specific version, we want to include that in default docs URL.
6 let version = getStaticBuildInfo()?.version;
7 if (!version) {
8 return docsUrl;
9 }
10
11 // Strip build metadata after '+', then remove a '-devel' suffix
12 // if present. Preserve '-rc.X' suffixes so versioned docs links
13 // point at the correct release candidate.
14 version = version.split("+")[0].replace(/-devel$/, "");
15 if (version === "v0.0.0") {
16 return docsUrl;
17 }
18 return `${docsUrl}/@${version}`;
19}
20
21// Add cache to avoid DOM reading all the time
22let CACHED_DOCS_URL: string | undefined;

Callers 1

getBaseDocsURLFunction · 0.85

Calls 1

getStaticBuildInfoFunction · 0.90

Tested by

no test coverage detected