_content/ref: specify redirect for /ref and /ref/ using /ref/index.md
We want both `/ref` and `/ref/` to point to `/doc/#references` section.
All documents for /ref/* are available from this unified website, so we
can set up a redirect rule using the native redirect support provided by
the internal/web package instead of relying on the internal/redirect rule.
Fixes golang/go#53243
Change-Id: Ibed1aefc82f8b93ae14775efbb456b1571053eda
Reviewed-on: https://go-review.googlesource.com/c/website/+/413914
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
diff --git a/_content/ref/index.md b/_content/ref/index.md
new file mode 100644
index 0000000..26e788e
--- /dev/null
+++ b/_content/ref/index.md
@@ -0,0 +1,3 @@
+<!--{
+ "Redirect": "/doc/#references"
+}-->
\ No newline at end of file
diff --git a/cmd/golangorg/testdata/web.txt b/cmd/golangorg/testdata/web.txt
index 4bd5cc9..8276447 100644
--- a/cmd/golangorg/testdata/web.txt
+++ b/cmd/golangorg/testdata/web.txt
@@ -422,3 +422,9 @@
GET https://go.dev/dl/?mode=json
body contains .windows-amd64.msi
body !contains UA-
+
+GET https://go.dev/ref
+redirect == /doc/#references
+
+GET https://go.dev/ref/
+redirect == /doc/#references
diff --git a/internal/redirect/redirect.go b/internal/redirect/redirect.go
index 1a7ffdc..4728064 100644
--- a/internal/redirect/redirect.go
+++ b/internal/redirect/redirect.go
@@ -106,12 +106,6 @@
"/issues": "https://github.com/golang/go/issues",
"/design": "https://go.googlesource.com/proposal/+/master/design",
- // In Go 1.2 the references page is part of /doc/.
- "/ref": "/doc/#references",
- // This next rule clobbers /ref/spec and /ref/mem.
- // TODO(adg): figure out what to do here, if anything.
- // "/ref/": "/doc/#references",
-
// Be nice to people who are looking in the wrong place.
"/pkg/C/": "/cmd/cgo/",
"/doc/mem": "/ref/mem",
diff --git a/internal/redirect/redirect_test.go b/internal/redirect/redirect_test.go
index 1df1387..202554a 100644
--- a/internal/redirect/redirect_test.go
+++ b/internal/redirect/redirect_test.go
@@ -22,7 +22,6 @@
func TestRedirects(t *testing.T) {
var tests = map[string]redirectResult{
"/build": {301, "https://build.golang.org"},
- "/ref": {301, "/doc/#references"},
"/doc/mem": {301, "/ref/mem"},
"/doc/spec": {301, "/ref/spec"},
"/foo": errorResult(404),