2020-11-22 08:11:57 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import "net/http"
|
|
|
|
|
2021-03-22 07:20:56 +00:00
|
|
|
const taxonomyContextKey = "taxonomy"
|
|
|
|
|
|
|
|
func serveTaxonomy(w http.ResponseWriter, r *http.Request) {
|
|
|
|
blog := r.Context().Value(blogContextKey).(string)
|
|
|
|
tax := r.Context().Value(taxonomyContextKey).(*taxonomy)
|
|
|
|
allValues, err := allTaxonomyValues(blog, tax.Name)
|
|
|
|
if err != nil {
|
|
|
|
serveError(w, r, err.Error(), http.StatusInternalServerError)
|
|
|
|
return
|
2020-11-22 08:11:57 +00:00
|
|
|
}
|
2021-03-22 07:20:56 +00:00
|
|
|
render(w, r, templateTaxonomy, &renderData{
|
|
|
|
BlogString: blog,
|
|
|
|
Canonical: appConfig.Server.PublicAddress + r.URL.Path,
|
|
|
|
Data: map[string]interface{}{
|
|
|
|
"Taxonomy": tax,
|
|
|
|
"ValueGroups": groupStrings(allValues),
|
|
|
|
},
|
|
|
|
})
|
2020-11-22 08:11:57 +00:00
|
|
|
}
|