Move all Kind constants to its own package

See #11256
This commit is contained in:
Bjørn Erik Pedersen 2023-07-28 10:53:47 +02:00
parent 5542f02fbc
commit b3cb6788b2
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F
35 changed files with 386 additions and 323 deletions

View file

@ -18,7 +18,7 @@ import (
"strings"
"github.com/gohugoio/hugo/output"
"github.com/gohugoio/hugo/resources/page"
"github.com/gohugoio/hugo/resources/kinds"
"github.com/spf13/cast"
)
@ -34,20 +34,20 @@ func createDefaultOutputFormats(allFormats output.Formats) map[string]output.For
}
m := map[string]output.Formats{
page.KindPage: {htmlOut},
page.KindHome: defaultListTypes,
page.KindSection: defaultListTypes,
page.KindTerm: defaultListTypes,
page.KindTaxonomy: defaultListTypes,
kinds.KindPage: {htmlOut},
kinds.KindHome: defaultListTypes,
kinds.KindSection: defaultListTypes,
kinds.KindTerm: defaultListTypes,
kinds.KindTaxonomy: defaultListTypes,
// Below are for consistency. They are currently not used during rendering.
kindSitemap: {sitemapOut},
kindRobotsTXT: {robotsOut},
kind404: {htmlOut},
kinds.KindSitemap: {sitemapOut},
kinds.KindRobotsTXT: {robotsOut},
kinds.Kind404: {htmlOut},
}
// May be disabled
if rssFound {
m[kindRSS] = output.Formats{rssOut}
m[kinds.KindRSS] = output.Formats{rssOut}
}
return m
@ -69,7 +69,7 @@ func createSiteOutputFormats(allFormats output.Formats, outputs map[string]any,
seen := make(map[string]bool)
for k, v := range outputs {
k = getKind(k)
k = kinds.GetKindAny(k)
if k == "" {
// Invalid kind
continue