Simple blogging system written in Go https://goblog.app
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

23 lines
628 B

package main
import "net/http"
const taxonomyContextKey = "taxonomy"
func (a *goBlog) serveTaxonomy(w http.ResponseWriter, r *http.Request) {
blog := r.Context().Value(blogContextKey).(string)
tax := r.Context().Value(taxonomyContextKey).(*taxonomy)
allValues, err := a.db.allTaxonomyValues(blog, tax.Name)
if err != nil {
a.serveError(w, r, err.Error(), http.StatusInternalServerError)
return
}
a.render(w, r, templateTaxonomy, &renderData{
BlogString: blog,
Canonical: a.getFullAddress(r.URL.Path),
Data: map[string]interface{}{
"Taxonomy": tax,
"ValueGroups": groupStrings(allValues),
},
})
}