GoBlog/taxonomies.go

22 lines
577 B
Go
Raw Normal View History

2020-11-22 08:11:57 +00:00
package main
import "net/http"
func serveTaxonomy(blog string, tax *taxonomy) func(w http.ResponseWriter, r *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
allValues, err := allTaxonomyValues(blog, tax.Name)
if err != nil {
2020-12-24 09:09:34 +00:00
serveError(w, r, err.Error(), http.StatusInternalServerError)
2020-11-22 08:11:57 +00:00
return
}
2021-02-20 22:35:16 +00:00
render(w, r, templateTaxonomy, &renderData{
2021-01-17 11:53:07 +00:00
BlogString: blog,
2020-11-22 08:11:57 +00:00
Canonical: appConfig.Server.PublicAddress + r.URL.Path,
Data: map[string]interface{}{
"Taxonomy": tax,
"ValueGroups": groupStrings(allValues),
},
})
}
}