mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: update documentation links to the new format (#13797)
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user