diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2020-06-16 15:43:50 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2020-06-18 09:09:56 +0200 |
commit | fc045e12a953aac88b942c25b958c5c0554b252b (patch) | |
tree | ad8e171d0730f55eb9a531c1a9f0a8dfb51065ad /hugolib/site_output_test.go | |
parent | 9679023f2b0d7c55b70f23fd94603f301a841079 (diff) |
Rename taxonomy kinds from taxonomy to term, taxonomyTerm to taxonomy
And we have taken great measures to limit potential site breakage:
* For `disableKinds` and `outputs` we try to map from old to new values if possible, if not we print an ERROR that can be toggled off if not relevant.
* The layout lookup is mostly compatible with more options for the new `term` kind.
That leaves:
* Where queries in site.Pages using taxonomy/taxonomyTerm Kind values as filter.
* Other places where these kind value are used in the templates (classes etc.)
Fixes #6911
Fixes #7395
Diffstat (limited to 'hugolib/site_output_test.go')
-rw-r--r-- | hugolib/site_output_test.go | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/hugolib/site_output_test.go b/hugolib/site_output_test.go index 232364577..c324be7dd 100644 --- a/hugolib/site_output_test.go +++ b/hugolib/site_output_test.go @@ -49,7 +49,7 @@ baseURL = "http://example.com/blog" paginate = 1 defaultContentLanguage = "en" -disableKinds = ["section", "taxonomy", "taxonomyTerm", "RSS", "sitemap", "robotsTXT", "404"] +disableKinds = ["section", "term", "taxonomy", "RSS", "sitemap", "robotsTXT", "404"] [Taxonomies] tag = "tags" @@ -226,7 +226,7 @@ baseURL = "http://example.com/blog" paginate = 1 defaultContentLanguage = "en" -disableKinds = ["page", "section", "taxonomy", "taxonomyTerm", "sitemap", "robotsTXT", "404"] +disableKinds = ["page", "section", "term", "taxonomy", "sitemap", "robotsTXT", "404"] [outputFormats] [outputFormats.RSS] @@ -263,7 +263,7 @@ baseURL = "http://example.com/blog" paginate = 1 defaultContentLanguage = "en" -disableKinds = ["page", "section", "taxonomy", "taxonomyTerm", "sitemap", "robotsTXT", "404"] +disableKinds = ["page", "section", "term", "taxonomy", "sitemap", "robotsTXT", "404"] [mediaTypes] [mediaTypes."text/nodot"] @@ -341,14 +341,14 @@ func TestCreateSiteOutputFormats(t *testing.T) { cfg := viper.New() cfg.Set("outputs", outputsConfig) - outputs, err := createSiteOutputFormats(output.DefaultFormats, cfg, false) + outputs, err := createSiteOutputFormats(output.DefaultFormats, cfg.GetStringMap("outputs"), false) c.Assert(err, qt.IsNil) c.Assert(outputs[page.KindSection], deepEqualsOutputFormats, output.Formats{output.JSONFormat}) c.Assert(outputs[page.KindHome], deepEqualsOutputFormats, output.Formats{output.HTMLFormat, output.JSONFormat}) // Defaults + c.Assert(outputs[page.KindTerm], deepEqualsOutputFormats, output.Formats{output.HTMLFormat, output.RSSFormat}) c.Assert(outputs[page.KindTaxonomy], deepEqualsOutputFormats, output.Formats{output.HTMLFormat, output.RSSFormat}) - c.Assert(outputs[page.KindTaxonomyTerm], deepEqualsOutputFormats, output.Formats{output.HTMLFormat, output.RSSFormat}) c.Assert(outputs[page.KindPage], deepEqualsOutputFormats, output.Formats{output.HTMLFormat}) // These aren't (currently) in use when rendering in Hugo, @@ -367,13 +367,15 @@ func TestCreateSiteOutputFormats(t *testing.T) { cfg := viper.New() outputsConfig := map[string]interface{}{ + // Note that we in Hugo 0.53.0 renamed this Kind to "taxonomy", + // but keep this test to test the legacy mapping. "taxonomyterm": []string{"JSON"}, } cfg.Set("outputs", outputsConfig) - outputs, err := createSiteOutputFormats(output.DefaultFormats, cfg, false) + outputs, err := createSiteOutputFormats(output.DefaultFormats, cfg.GetStringMap("outputs"), false) c.Assert(err, qt.IsNil) - c.Assert(outputs[page.KindTaxonomyTerm], deepEqualsOutputFormats, output.Formats{output.JSONFormat}) + c.Assert(outputs[page.KindTaxonomy], deepEqualsOutputFormats, output.Formats{output.JSONFormat}) }) @@ -389,7 +391,7 @@ func TestCreateSiteOutputFormatsInvalidConfig(t *testing.T) { cfg := viper.New() cfg.Set("outputs", outputsConfig) - _, err := createSiteOutputFormats(output.DefaultFormats, cfg, false) + _, err := createSiteOutputFormats(output.DefaultFormats, cfg.GetStringMap("outputs"), false) c.Assert(err, qt.Not(qt.IsNil)) } @@ -403,7 +405,7 @@ func TestCreateSiteOutputFormatsEmptyConfig(t *testing.T) { cfg := viper.New() cfg.Set("outputs", outputsConfig) - outputs, err := createSiteOutputFormats(output.DefaultFormats, cfg, false) + outputs, err := createSiteOutputFormats(output.DefaultFormats, cfg.GetStringMap("outputs"), false) c.Assert(err, qt.IsNil) c.Assert(outputs[page.KindHome], deepEqualsOutputFormats, output.Formats{output.HTMLFormat, output.RSSFormat}) } @@ -423,7 +425,7 @@ func TestCreateSiteOutputFormatsCustomFormats(t *testing.T) { customHTML = output.Format{Name: "HTML", BaseName: "customHTML"} ) - outputs, err := createSiteOutputFormats(output.Formats{customRSS, customHTML}, cfg, false) + outputs, err := createSiteOutputFormats(output.Formats{customRSS, customHTML}, cfg.GetStringMap("outputs"), false) c.Assert(err, qt.IsNil) c.Assert(outputs[page.KindHome], deepEqualsOutputFormats, output.Formats{customHTML, customRSS}) } |