Skip to content

fix: add version information to default docs links #14205

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 9, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Update site/src/utils/docs.ts
Co-authored-by: Kayla Washburn-Love <mckayla@hey.com>
  • Loading branch information
bcpeinhardt and aslilac authored Aug 8, 2024
commit be2a76ccb92f2edbede02e2ffdc18bd5012a056f
6 changes: 5 additions & 1 deletion site/src/utils/docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import { getStaticBuildInfo } from "./buildInfo";
function defaultDocsUrl(): string {
const docsUrl = "https://coder.com/docs";
// If we can get the specific version, we want to include that in default docs URL.
const version = getStaticBuildInfo()?.version.split("-")[0];
let version = getStaticBuildInfo()?.version;
const i = version?.indexOf("-") ?? -1;
if (version.index >= 0) {
version = version.slice(0, i);
}
return version ? `${docsUrl}/@${version}` : docsUrl;
}

Expand Down
Loading