···9999 // domains.
100100 HostCustomQueries map[string]string
101101102102- // This should contain the following templates: "didyoumean"
103103- // (for suggestions), "repolist" (for the repo search result
104104- // page), "result" for the search results, "search" (for the
105105- // opening page), "box" for the search query input element and
102102+ // This should contain the following templates: "repolist"
103103+ // (for the repo search result page), "result" for
104104+ // the search results, "search" (for the opening page),
105105+ // "box" for the search query input element and
106106 // "print" for the show file functionality.
107107 Top *template.Template
108108109109- didYouMean *template.Template
110109 repolist *template.Template
111110 search *template.Template
112111 result *template.Template
···148147 }
149148150149 for k, v := range map[string]**template.Template{
151151- "didyoumean": &s.didYouMean,
152150 "results": &s.result,
153151 "print": &s.print,
154152 "search": &s.search,
···201199202200func (s *Server) serveSearch(w http.ResponseWriter, r *http.Request) {
203201 err := s.serveSearchErr(w, r)
204204-205205- if suggest, ok := err.(*query.SuggestQueryError); ok {
206206- var buf bytes.Buffer
207207- if err := s.didYouMean.Execute(&buf, suggest); err != nil {
208208- http.Error(w, err.Error(), http.StatusTeapot)
209209- }
210210-211211- w.Write(buf.Bytes())
212212- return
213213- }
214202215203 if err != nil {
216204 http.Error(w, err.Error(), http.StatusTeapot)
-11
web/templates.go
···2525// TemplateText contains the text of the standard templates.
2626var TemplateText = map[string]string{
27272828- "didyoumean": `
2929-<html>
3030-<head>
3131- <title>Error</title>
3232-</head>
3333-<body>
3434- <p>{{.Message}}. Did you mean <a href="/search?q={{.Suggestion}}">{{.Suggestion}}</a> ?
3535-</body>
3636-</html>
3737-`,
3838-3928 "head": `
4029<head>
4130<meta charset="utf-8">