tour: serve from cmd/golangorg as go.dev/tour
tour.golang.org is the last independent server in this repository
and almost the last golang.org domain with user-facing content.
(talks.golang.org remains.)
We need to keep golang.org/x/website/tour as a runnable binary,
but move the logic into internal/tour so it can be used from both
the tour binary and cmd/golangorg.
After this is deployed, we will need to delete the current tour app
from the golang-org project, and then requests for tour.golang.org
will default to the main server (cmd/golangorg).
This will make the tour available in China for the first time,
at golang.google.cn/tour.
Change-Id: I0f025d8ae89e12489d26bb3bc380a833eeb57bcc
Reviewed-on: https://go-review.googlesource.com/c/website/+/365100
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
diff --git a/content.go b/content.go
index 3b59616..40ea366 100644
--- a/content.go
+++ b/content.go
@@ -10,12 +10,22 @@
"io/fs"
)
-// Content is the go.dev website's static content.
-var Content fs.FS = subdir(embedded, "_content")
+// Content returns the go.dev website's static content.
+func Content() fs.FS {
+ return subdir(embedded, "_content")
+}
+
+// TourOnly returns the content needed only for the standalone tour.
+func TourOnly() fs.FS {
+ return subdir(tourOnly, "_content")
+}
//go:embed _content
var embedded embed.FS
+//go:embed _content/tour _content/favicon.ico _content/images/go-logo-white.svg
+var tourOnly embed.FS
+
func subdir(fsys fs.FS, path string) fs.FS {
s, err := fs.Sub(fsys, path)
if err != nil {