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

@ -29,6 +29,7 @@ import (
"github.com/gohugoio/hugo/output"
"github.com/gohugoio/hugo/resources/kinds"
"github.com/gohugoio/hugo/resources/page"
"github.com/gohugoio/hugo/resources/page/pagemeta"
)
@ -228,7 +229,7 @@ func (s *Site) renderPaginator(p *pageState, templ tpl.Template) error {
func (s *Site) render404() error {
p, err := newPageStandalone(&pageMeta{
s: s,
kind: kind404,
kind: kinds.Kind404,
urlPaths: pagemeta.URLPath{
URL: "404.html",
},
@ -244,7 +245,7 @@ func (s *Site) render404() error {
}
var d layouts.LayoutDescriptor
d.Kind = kind404
d.Kind = kinds.Kind404
templ, found, err := s.Tmpl().LookupLayout(d, output.HTMLFormat)
if err != nil {
@ -266,7 +267,7 @@ func (s *Site) render404() error {
func (s *Site) renderSitemap() error {
p, err := newPageStandalone(&pageMeta{
s: s,
kind: kindSitemap,
kind: kinds.KindSitemap,
urlPaths: pagemeta.URLPath{
URL: s.conf.Sitemap.Filename,
},
@ -294,13 +295,13 @@ func (s *Site) renderSitemap() error {
}
func (s *Site) renderRobotsTXT() error {
if !s.conf.EnableRobotsTXT && s.isEnabled(kindRobotsTXT) {
if !s.conf.EnableRobotsTXT && s.isEnabled(kinds.KindRobotsTXT) {
return nil
}
p, err := newPageStandalone(&pageMeta{
s: s,
kind: kindRobotsTXT,
kind: kinds.KindRobotsTXT,
urlPaths: pagemeta.URLPath{
URL: "robots.txt",
},