diff options
| author | Russ Cox <rsc@golang.org> | 2021-11-17 22:26:53 -0500 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2021-11-22 13:36:17 +0000 |
| commit | 22392b8d52d95d38cd439a8bc1dd70d04d655efb (patch) | |
| tree | 75d400217e00a7bc5b4e032fa891f895672537fc /internal/frontend/server.go | |
| parent | b8b6586b3696b6b6a420168bd9ef801bd9f82bc2 (diff) | |
| download | go-x-pkgsite-22392b8d52d95d38cd439a8bc1dd70d04d655efb.tar.xz | |
pkgsite: add /about page, copied from go.dev/about
go.dev/about is mostly about pkg.go.dev, which has always been odd.
Fix it by creating pkg.go.dev/about with the same info.
Once this page is live, go.dev/about will start redirecting to pkg.go.dev/about.
Change-Id: Ib49b688f8775cc3e83a07018ce038779935ae4c1
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/364974
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Diffstat (limited to 'internal/frontend/server.go')
| -rw-r--r-- | internal/frontend/server.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/internal/frontend/server.go b/internal/frontend/server.go index 78149a57..c64e59fa 100644 --- a/internal/frontend/server.go +++ b/internal/frontend/server.go @@ -159,7 +159,7 @@ func (s *Server) Install(handle func(string, http.Handler), redisClient *redis.C handle("/search", searchHandler) handle("/search-help", s.staticPageHandler("search-help", "Search Help")) handle("/license-policy", s.licensePolicyHandler()) - handle("/about", http.RedirectHandler("https://go.dev/about", http.StatusFound)) + handle("/about", s.aboutHandler()) handle("/badge/", http.HandlerFunc(s.badgeHandler)) handle("/styleguide", http.HandlerFunc(s.errorHandler(s.serveStyleGuide))) handle("/C", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { @@ -431,6 +431,12 @@ func (s *Server) licensePolicyHandler() http.HandlerFunc { }) } +func (s *Server) aboutHandler() http.HandlerFunc { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + s.servePage(r.Context(), w, "about", basePage{}) + }) +} + // newBasePage returns a base page for the given request and title. func (s *Server) newBasePage(r *http.Request, title string) basePage { q := rawSearchQuery(r) @@ -695,6 +701,7 @@ func stripScheme(url string) string { func parsePageTemplates(fsys template.TrustedFS) (map[string]*template.Template, error) { templates := make(map[string]*template.Template) htmlSets := [][]string{ + {"about"}, {"badge"}, {"error"}, {"fetch"}, |
