godoc: add GoogleCN property to pages
Use that property to determine whether to show share functionality
or link to sites that are blocked in mainland China.
This change requires https://go-review.googlesource.com/c/52872
Change-Id: I47327f9dbd2624206564fa99eb1cc6a10b4f46db
Reviewed-on: https://go-review.googlesource.com/52873
Reviewed-by: Chris Broadfoot <cbro@golang.org>
diff --git a/godoc/godoc.go b/godoc/godoc.go
index a9e8b3b..5c6d982 100644
--- a/godoc/godoc.go
+++ b/godoc/godoc.go
@@ -421,9 +421,9 @@
}
type PageInfo struct {
- Dirname string // directory containing the package
- Err error // error or nil
- Share bool // show share button on examples
+ Dirname string // directory containing the package
+ Err error // error or nil
+ GoogleCN bool // page is being served from golang.google.cn
Mode PageInfoMode // display metadata from query string
@@ -683,8 +683,8 @@
err := p.ExampleHTML.Execute(&buf, struct {
Name, Doc, Code, Play, Output string
- Share bool
- }{eg.Name, eg.Doc, code, play, out, info.Share})
+ GoogleCN bool
+ }{eg.Name, eg.Doc, code, play, out, info.GoogleCN})
if err != nil {
log.Print(err)
}