chore: update documentation links to the new format (#13797)

This commit is contained in:
Muhammad Atif Ali
2024-07-10 21:31:37 +03:00
committed by GitHub
parent 2a297b073a
commit 0787de88a9
87 changed files with 213 additions and 222 deletions

View File

@ -4,7 +4,6 @@ import (
"fmt"
"strings"
"github.com/coder/coder/v2/buildinfo"
"github.com/coder/coder/v2/coderd/util/ptr"
)
@ -49,7 +48,7 @@ const (
// Default docs URL
var (
docsURLDefault = "https://coder.com/docs/v2"
docsURLDefault = "https://coder.com/docs"
)
// @typescript-generate Severity
@ -92,12 +91,7 @@ func (m Message) URL(base string) string {
if base == "" {
base = docsURLDefault
versionPath := buildinfo.Version()
if buildinfo.IsDev() {
// for development versions, just use latest
versionPath = "latest"
}
return fmt.Sprintf("%s/%s/admin/healthcheck#%s", base, versionPath, codeAnchor)
return fmt.Sprintf("%s/admin/healthcheck#%s", base, codeAnchor)
}
// We don't assume that custom docs URLs are versioned.

View File

@ -17,8 +17,8 @@ func Test_MessageURL(t *testing.T) {
base string
expected string
}{
{"empty", "", "", "https://coder.com/docs/v2/latest/admin/healthcheck#eunknown"},
{"default", health.CodeAccessURLFetch, "", "https://coder.com/docs/v2/latest/admin/healthcheck#eacs03"},
{"empty", "", "", "https://coder.com/docs/admin/healthcheck#eunknown"},
{"default", health.CodeAccessURLFetch, "", "https://coder.com/docs/admin/healthcheck#eacs03"},
{"custom docs base", health.CodeAccessURLFetch, "https://example.com/docs", "https://example.com/docs/admin/healthcheck#eacs03"},
} {
tt := tt