diff --git a/go.mod b/go.mod index 75d140e..f790759 100644 --- a/go.mod +++ b/go.mod @@ -54,7 +54,7 @@ require ( golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 // indirect golang.org/x/text v0.3.4 // indirect - golang.org/x/tools v0.0.0-20201120032337-6d151481565c // indirect + golang.org/x/tools v0.0.0-20201121010211-780cb80bd7fb // indirect gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b // indirect gopkg.in/ini.v1 v1.62.0 // indirect gopkg.in/yaml.v2 v2.3.0 // indirect diff --git a/go.sum b/go.sum index e03c47a..9552864 100644 --- a/go.sum +++ b/go.sum @@ -467,8 +467,8 @@ golang.org/x/tools v0.0.0-20191216052735-49a3e744a425 h1:VvQyQJN0tSuecqgcIxMWnnf golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200410194907-79a7a3126eef/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20201120032337-6d151481565c h1:IXtuZap6vTKIQ3jemmcwf2gY4BT+lwfZHBYwxMGe5/k= -golang.org/x/tools v0.0.0-20201120032337-6d151481565c/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201121010211-780cb80bd7fb h1:z5+u0pkAUPUWd3taoTialQ2JAMo4Wo1Z3L25U4ZV9r0= +golang.org/x/tools v0.0.0-20201121010211-780cb80bd7fb/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= diff --git a/posts.go b/posts.go index 9f56969..d5768b0 100644 --- a/posts.go +++ b/posts.go @@ -105,27 +105,6 @@ func serveSection(blog string, path string, section *section) func(w http.Respon }) } -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 { - http.Error(w, err.Error(), http.StatusInternalServerError) - return - } - render(w, templateTaxonomy, &renderData{ - blogString: blog, - Canonical: appConfig.Server.PublicAddress + r.URL.Path, - Data: struct { - Taxonomy *taxonomy - TaxonomyValues []string - }{ - Taxonomy: tax, - TaxonomyValues: allValues, - }, - }) - } -} - func serveTaxonomyValue(blog string, path string, tax *taxonomy, value string) func(w http.ResponseWriter, r *http.Request) { return serveIndex(&indexConfig{ blog: blog, diff --git a/taxonomies.go b/taxonomies.go new file mode 100644 index 0000000..d03ef1f --- /dev/null +++ b/taxonomies.go @@ -0,0 +1,21 @@ +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 { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + render(w, templateTaxonomy, &renderData{ + blogString: blog, + Canonical: appConfig.Server.PublicAddress + r.URL.Path, + Data: map[string]interface{}{ + "Taxonomy": tax, + "ValueGroups": groupStrings(allValues), + }, + }) + } +} diff --git a/templates/footer.gohtml b/templates/footer.gohtml index ea62a2e..98e5516 100644 --- a/templates/footer.gohtml +++ b/templates/footer.gohtml @@ -1,10 +1,8 @@ {{ define "footer" }}