aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2021-08-13 16:11:21 -0400
committerRuss Cox <rsc@golang.org>2021-08-18 14:38:28 +0000
commit6b7d17b41d40ac6a74a8ed03c5585d46fd6ac8e6 (patch)
tree4d4fbe5fad9775547a6695dc2cfd1f1a6f29c49c
parentacb763a4b254011f55917d12ce4919d096275ee5 (diff)
downloadgo-x-website-6b7d17b41d40ac6a74a8ed03c5585d46fd6ac8e6.tar.xz
go.dev: update to new interim menus
Also fix site footer to file x/website issue, not x/pkgsite. Change-Id: I6549b7b4108ef51b41c2715577beb785943a50a6 Reviewed-on: https://go-review.googlesource.com/c/website/+/342093 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Jamal Carvalho <jamal@golang.org>
-rw-r--r--cmd/golangorg/server.go8
-rw-r--r--go.dev/_content/learn/index.md2
-rw-r--r--go.dev/_content/menus.yaml18
-rw-r--r--go.dev/_content/site.tmpl6
4 files changed, 23 insertions, 11 deletions
diff --git a/cmd/golangorg/server.go b/cmd/golangorg/server.go
index cc72ae47..6f61dcbe 100644
--- a/cmd/golangorg/server.go
+++ b/cmd/golangorg/server.go
@@ -444,6 +444,14 @@ type linkRewriter struct {
ct string // content-type
}
+func (r *linkRewriter) WriteHeader(code int) {
+ loc := r.Header().Get("Location")
+ if strings.HasPrefix(loc, "/") {
+ r.Header().Set("Location", "/"+r.host+loc)
+ }
+ r.ResponseWriter.WriteHeader(code)
+}
+
func (r *linkRewriter) Write(data []byte) (int, error) {
if r.ct == "" {
ct := r.Header().Get("Content-Type")
diff --git a/go.dev/_content/learn/index.md b/go.dev/_content/learn/index.md
index 816d6695..2ee639a0 100644
--- a/go.dev/_content/learn/index.md
+++ b/go.dev/_content/learn/index.md
@@ -1,5 +1,5 @@
---
-title: "Getting Started"
+title: "Get Started"
---
<section class="Learn-hero">
diff --git a/go.dev/_content/menus.yaml b/go.dev/_content/menus.yaml
index 321d9964..ec942196 100644
--- a/go.dev/_content/menus.yaml
+++ b/go.dev/_content/menus.yaml
@@ -1,12 +1,16 @@
main:
- name: Why Go
url: /solutions/
- - name: Getting Started
+ - name: Get Started
url: /learn/
- - name: Discover Packages
+ - name: Docs
+ url: https://golang.org/doc/
+ - name: Packages
url: https://pkg.go.dev
- - name: About
- url: /about
+ - name: Play
+ url: https://play.golang.org/
+ - name: Blog
+ url: /blog/
footer:
- name: Why Go
@@ -17,7 +21,7 @@ footer:
- name: Case Studies
url: /solutions/#case-studies
- - name: Getting Started
+ - name: Get Started
url: /learn/
children:
- name: Playground
@@ -27,7 +31,7 @@ footer:
- name: Stack Overflow
url: https://stackoverflow.com/questions/tagged/go?tab=Newest
- - name: Discover Packages
+ - name: Packages
url: https://pkg.go.dev
- name: About
@@ -36,7 +40,7 @@ footer:
- name: Download
url: https://golang.org/dl/
- name: Blog
- url: https://blog.golang.org
+ url: /blog/
- name: Issue Tracker
url: https://github.com/golang/go/issues
- name: Release Notes
diff --git a/go.dev/_content/site.tmpl b/go.dev/_content/site.tmpl
index c77e6d3e..e2cf7bb5 100644
--- a/go.dev/_content/site.tmpl
+++ b/go.dev/_content/site.tmpl
@@ -59,7 +59,7 @@
<ul class="Header-menu">
{{- $currentPage := .}}
{{- range $menus.main}}
- <li class="Header-menuItem {{if eq $currentPage.title .name}} Header-menuItem--active{{end}}">
+ <li class="Header-menuItem {{if strings.HasPrefix $currentPage.URL .url}} Header-menuItem--active{{end}}">
<a href="{{.url}}">{{.name}}</a>
</li>
{{- end}}
@@ -93,7 +93,7 @@
</div>
<ul class="NavigationDrawer-list">
{{- range $menus.main}}
- <li class="NavigationDrawer-listItem {{if eq .url (section $currentPage)}} NavigationDrawer-listItem--active{{end}}">
+ <li class="NavigationDrawer-listItem {{if strings.HasPrefix $currentPage.URL .url}} NavigationDrawer-listItem--active{{end}}">
<a href="{{.url}}">{{.name}}</a>
</li>
{{- end}}
@@ -143,7 +143,7 @@
</li>
<li class="Footer-listItem">
<a
- href="https://golang.org/s/discovery-feedback"
+ href="https://golang.org/s/website-issue"
target="_blank"
rel="noopener"
>