aboutsummaryrefslogtreecommitdiff
path: root/cmd/golangorg/server.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2021-08-03 00:54:24 -0400
committerRuss Cox <rsc@golang.org>2021-08-18 19:48:35 +0000
commit6c6d3e7c40fa86abd6fe6d0dd6ddaf0155d738f6 (patch)
treed2b09af3aee08b81789abf8404f3eef669718e77 /cmd/golangorg/server.go
parent9b8de9f9de492b179320c9aa0716a2cd2a631839 (diff)
downloadgo-x-website-6c6d3e7c40fa86abd6fe6d0dd6ddaf0155d738f6.tar.xz
cmd/golangorg: move blog from blog.golang.org to go.dev/blog
This is the first of a sequence of consolidations of web sites into the single site go.dev. An accompanying blog post (next CL) will explain the change. The blog/_content tree moves to go.dev/_content/blog. The *.article files were converted to *.md files using rsc.io/tmp/blog2md. The old dot directives are now template function invocations, so that blog content files are now exactly the same format and semantics as regular site content files. All the old blog redirects are carried forward, of course. Also add exhaustive test that every .md file renders correctly. Also rename rawhtml to raw, because it gets used for raw Markdown too. The raw Markdown issue is working around a bigger problem (html/template is not really right for Markdown) that we will have to solve at some point, but not in this CL. Change-Id: Ifa9b3b8d656a72af30d0d4e57e4c7bc8dacbc386 Reviewed-on: https://go-review.googlesource.com/c/website/+/342091 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jamal Carvalho <jamal@golang.org>
Diffstat (limited to 'cmd/golangorg/server.go')
-rw-r--r--cmd/golangorg/server.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/cmd/golangorg/server.go b/cmd/golangorg/server.go
index 6f61dcbe..838eab00 100644
--- a/cmd/golangorg/server.go
+++ b/cmd/golangorg/server.go
@@ -55,6 +55,8 @@ var (
runningOnAppEngine = os.Getenv("PORT") != ""
+ tipFlag = flag.Bool("tip", runningOnAppEngine, "load git content for tip.golang.org")
+
googleAnalytics string
)
@@ -123,8 +125,6 @@ func main() {
}
}
-var isTestBinary = false
-
// NewHandler returns the http.Handler for the web site,
// given the directory where the content can be found
// (can be "", in which case an internal copy is used)
@@ -176,7 +176,7 @@ func NewHandler(contentDir, goroot string) http.Handler {
// which broke the redirect.
mux.Handle("m.golang.org/", http.RedirectHandler("https://mail.google.com/a/golang.org/", http.StatusMovedPermanently))
- if !isTestBinary {
+ if *tipFlag {
go watchTip(&tipGoroot)
}
@@ -206,7 +206,9 @@ func NewHandler(contentDir, goroot string) http.Handler {
log.Fatalf("godevHandler: %v", err)
}
mux.Handle("go.dev/", godev)
- mux.Handle("learn.go.dev/", godev)
+
+ mux.Handle("blog.golang.org/", redirectPrefix("https://go.dev/blog/"))
+ mux.Handle("learn.go.dev/", redirectPrefix("https://go.dev/learn/"))
var h http.Handler = mux
if env.EnforceHosts() {