diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-07-28 10:53:47 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-07-28 15:14:23 +0200 |
commit | b3cb6788b2634a89ae774895f345f082020b52d8 (patch) | |
tree | 08eadc21d9308510e332a4898d2c06516cb6e497 | |
parent | 5542f02fbc4c9467a4338ee1ce2e741f480a0751 (diff) |
Move all Kind constants to its own package
See #11256
35 files changed, 388 insertions, 325 deletions
diff --git a/config/allconfig/allconfig.go b/config/allconfig/allconfig.go index ec95f5eba..6d206d7a4 100644 --- a/config/allconfig/allconfig.go +++ b/config/allconfig/allconfig.go @@ -45,6 +45,7 @@ import ( "github.com/gohugoio/hugo/output" "github.com/gohugoio/hugo/related" "github.com/gohugoio/hugo/resources/images" + "github.com/gohugoio/hugo/resources/kinds" "github.com/gohugoio/hugo/resources/page" "github.com/gohugoio/hugo/resources/page/pagemeta" "github.com/spf13/afero" @@ -940,11 +941,11 @@ func createDefaultOutputFormats(allFormats output.Formats) map[string][]string { } m := map[string][]string{ - page.KindPage: {htmlOut.Name}, - page.KindHome: defaultListTypes, - page.KindSection: defaultListTypes, - page.KindTerm: defaultListTypes, - page.KindTaxonomy: defaultListTypes, + kinds.KindPage: {htmlOut.Name}, + kinds.KindHome: defaultListTypes, + kinds.KindSection: defaultListTypes, + kinds.KindTerm: defaultListTypes, + kinds.KindTaxonomy: defaultListTypes, } // May be disabled diff --git a/hugolib/content_map.go b/hugolib/content_map.go index 9abf0d5b0..8cb307691 100644 --- a/hugolib/content_map.go +++ b/hugolib/content_map.go @@ -22,6 +22,7 @@ import ( "github.com/gohugoio/hugo/helpers" + "github.com/gohugoio/hugo/resources/kinds" "github.com/gohugoio/hugo/resources/page" "github.com/gohugoio/hugo/hugofs/files" @@ -275,13 +276,13 @@ type contentBundleViewInfo struct { func (c *contentBundleViewInfo) kind() string { if c.termKey != "" { - return page.KindTerm + return kinds.KindTerm } - return page.KindTaxonomy + return kinds.KindTaxonomy } func (c *contentBundleViewInfo) sections() []string { - if c.kind() == page.KindTaxonomy { + if c.kind() == kinds.KindTaxonomy { return []string{c.name.plural} } diff --git a/hugolib/content_map_page.go b/hugolib/content_map_page.go index 6f02e2e29..e7f6c5aed 100644 --- a/hugolib/content_map_page.go +++ b/hugolib/content_map_page.go @@ -19,6 +19,7 @@ import ( "path" "path/filepath" "strings" + "sync" "github.com/gohugoio/hugo/common/maps" @@ -30,6 +31,7 @@ import ( "github.com/gohugoio/hugo/hugofs" "github.com/gohugoio/hugo/hugofs/files" "github.com/gohugoio/hugo/parser/pageparser" + "github.com/gohugoio/hugo/resources/kinds" "github.com/gohugoio/hugo/resources/page" "github.com/gohugoio/hugo/resources/resource" "github.com/spf13/cast" @@ -105,7 +107,7 @@ func (m *pageMap) newPageFromContentNode(n *contentNode, parentBucket *pagesMapB sections := s.sectionsFromFile(f) kind := s.kindFromFileInfoOrSections(f, sections) - if kind == page.KindTerm { + if kind == kinds.KindTerm { s.PathSpec.MakePathsSanitized(sections) } @@ -366,7 +368,7 @@ func (m *pageMap) assemblePages() error { return true } - shouldBuild = !(n.p.Kind() == page.KindPage && m.cfg.pageDisabled) && m.s.shouldBuild(n.p) + shouldBuild = !(n.p.Kind() == kinds.KindPage && m.cfg.pageDisabled) && m.s.shouldBuild(n.p) if !shouldBuild { m.deletePage(s) return false @@ -469,9 +471,9 @@ func (m *pageMap) assembleSections() error { parentBucket = m.s.siteBucket } - kind := page.KindSection + kind := kinds.KindSection if s == "/" { - kind = page.KindHome + kind = kinds.KindHome } if n.fi != nil { @@ -537,7 +539,7 @@ func (m *pageMap) assembleTaxonomies() error { } } else { title := "" - if kind == page.KindTerm { + if kind == kinds.KindTerm { title = n.viewInfo.term() } n.p = m.s.newPage(n, parent.p.bucket, kind, title, sections...) diff --git a/hugolib/disableKinds_test.go b/hugolib/disableKinds_test.go index 87a60d636..c24f6b10e 100644 --- a/hugolib/disableKinds_test.go +++ b/hugolib/disableKinds_test.go @@ -17,6 +17,7 @@ import ( "testing" qt "github.com/frankban/quicktest" + "github.com/gohugoio/hugo/resources/kinds" "github.com/gohugoio/hugo/resources/page" ) @@ -134,7 +135,7 @@ title: Headless Local Lists Sub return nil } - disableKind := page.KindPage + disableKind := kinds.KindPage c.Run("Disable "+disableKind, func(c *qt.C) { b := newSitesBuilder(c, disableKind) b.Build(BuildCfg{}) @@ -149,7 +150,7 @@ title: Headless Local Lists Sub b.Assert(len(s.Taxonomies()["categories"]), qt.Equals, 0) }) - disableKind = page.KindTerm + disableKind = kinds.KindTerm c.Run("Disable "+disableKind, func(c *qt.C) { b := newSitesBuilder(c, disableKind) b.Build(BuildCfg{}) @@ -161,7 +162,7 @@ title: Headless Local Lists Sub b.Assert(getPage(b, "/categories/mycat"), qt.IsNil) }) - disableKind = page.KindTaxonomy + disableKind = kinds.KindTaxonomy c.Run("Disable "+disableKind, func(c *qt.C) { b := newSitesBuilder(c, disableKind) b.Build(BuildCfg{}) @@ -177,7 +178,7 @@ title: Headless Local Lists Sub b.Assert(getPageInPagePages(getPage(b, "/"), "/categories"), qt.IsNil) }) - disableKind = page.KindHome + disableKind = kinds.KindHome c.Run("Disable "+disableKind, func(c *qt.C) { b := newSitesBuilder(c, disableKind) b.Build(BuildCfg{}) @@ -190,7 +191,7 @@ title: Headless Local Lists Sub b.Assert(getPage(b, "/sect/page.md"), qt.Not(qt.IsNil)) }) - disableKind = page.KindSection + disableKind = kinds.KindSection c.Run("Disable "+disableKind, func(c *qt.C) { b := newSitesBuilder(c, disableKind) b.Build(BuildCfg{}) @@ -210,7 +211,7 @@ title: Headless Local Lists Sub b.AssertFileContent("public/index.xml", "rss") }) - disableKind = kindRSS + disableKind = kinds.KindRSS c.Run("Disable "+disableKind, func(c *qt.C) { b := newSitesBuilder(c, disableKind) b.Build(BuildCfg{}) @@ -219,21 +220,21 @@ title: Headless Local Lists Sub b.Assert(home.OutputFormats(), qt.HasLen, 1) }) - disableKind = kindSitemap + disableKind = kinds.KindSitemap c.Run("Disable "+disableKind, func(c *qt.C) { b := newSitesBuilder(c, disableKind) b.Build(BuildCfg{}) b.Assert(b.CheckExists("public/sitemap.xml"), qt.Equals, false) }) - disableKind = kind404 + disableKind = kinds.Kind404 c.Run("Disable "+disableKind, func(c *qt.C) { b := newSitesBuilder(c, disableKind) b.Build(BuildCfg{}) b.Assert(b.CheckExists("public/404.html"), qt.Equals, false) }) - disableKind = kindRobotsTXT + disableKind = kinds.KindRobotsTXT c.Run("Disable "+disableKind, func(c *qt.C) { b := newSitesBuilder(c, disableKind) b.WithTemplatesAdded("robots.txt", "myrobots") diff --git a/hugolib/hugo_sites.go b/hugolib/hugo_sites.go index 3b5efa2e5..eb0385cda 100644 --- a/hugolib/hugo_sites.go +++ b/hugolib/hugo_sites.go @@ -47,6 +47,7 @@ import ( "github.com/gohugoio/hugo/helpers" "github.com/gohugoio/hugo/lazy" + "github.com/gohugoio/hugo/resources/kinds" "github.com/gohugoio/hugo/resources/page" "github.com/gohugoio/hugo/resources/page/pagemeta" "github.com/gohugoio/hugo/tpl" @@ -443,7 +444,7 @@ func (h *HugoSites) renderCrossSitesSitemap() error { sitemapEnabled := false for _, s := range h.Sites { - if s.conf.IsKindEnabled(kindSitemap) { + if s.conf.IsKindEnabled(kinds.KindSitemap) { sitemapEnabled = true break } @@ -474,7 +475,7 @@ func (h *HugoSites) renderCrossSitesRobotsTXT() error { p, err := newPageStandalone(&pageMeta{ s: s, - kind: kindRobotsTXT, + kind: kinds.KindRobotsTXT, urlPaths: pagemeta.URLPath{ URL: "robots.txt", }, @@ -523,7 +524,7 @@ func (h *HugoSites) createPageCollections() error { }) allRegularPages := newLazyPagesFactory(func() page.Pages { - return h.findPagesByKindIn(page.KindPage, allPages.get()) + return h.findPagesByKindIn(kinds.KindPage, allPages.get()) }) for _, s := range h.Sites { diff --git a/hugolib/hugo_sites_build_test.go b/hugolib/hugo_sites_build_test.go index 3c82a60b6..bdbf4270e 100644 --- a/hugolib/hugo_sites_build_test.go +++ b/hugolib/hugo_sites_build_test.go @@ -10,7 +10,7 @@ import ( qt "github.com/frankban/quicktest" "github.com/gohugoio/hugo/common/loggers" "github.com/gohugoio/hugo/htesting" - "github.com/gohugoio/hugo/resources/page" + "github.com/gohugoio/hugo/resources/kinds" "github.com/fortytw2/leaktest" "github.com/fsnotify/fsnotify" @@ -182,12 +182,12 @@ p1 = "p1en" c.Assert(len(sites), qt.Equals, 2) nnSite := sites[0] - nnHome := nnSite.getPage(page.KindHome) + nnHome := nnSite.getPage(kinds.KindHome) c.Assert(len(nnHome.AllTranslations()), qt.Equals, 2) c.Assert(len(nnHome.Translations()), qt.Equals, 1) c.Assert(nnHome.IsTranslated(), qt.Equals, true) - enHome := sites[1].getPage(page.KindHome) + enHome := sites[1].getPage(kinds.KindHome) p1, err := enHome.Param("p1") c.Assert(err, qt.IsNil) @@ -239,7 +239,7 @@ func doTestMultiSitesBuild(t *testing.T, configTemplate, configSuffix string) { c.Assert(gp2, qt.IsNil) enSite := sites[0] - enSiteHome := enSite.getPage(page.KindHome) + enSiteHome := enSite.getPage(kinds.KindHome) c.Assert(enSiteHome.IsTranslated(), qt.Equals, true) c.Assert(enSite.language.Lang, qt.Equals, "en") @@ -300,10 +300,10 @@ func doTestMultiSitesBuild(t *testing.T, configTemplate, configSuffix string) { // isn't ideal in a multilingual setup. You want a way to get the current language version if available. // Now you can do lookups with translation base name to get that behaviour. // Let us test all the regular page variants: - getPageDoc1En := enSite.getPage(page.KindPage, filepath.ToSlash(doc1en.File().Path())) - getPageDoc1EnBase := enSite.getPage(page.KindPage, "sect/doc1") - getPageDoc1Fr := frSite.getPage(page.KindPage, filepath.ToSlash(doc1fr.File().Path())) - getPageDoc1FrBase := frSite.getPage(page.KindPage, "sect/doc1") + getPageDoc1En := enSite.getPage(kinds.KindPage, filepath.ToSlash(doc1en.File().Path())) + getPageDoc1EnBase := enSite.getPage(kinds.KindPage, "sect/doc1") + getPageDoc1Fr := frSite.getPage(kinds.KindPage, filepath.ToSlash(doc1fr.File().Path())) + getPageDoc1FrBase := frSite.getPage(kinds.KindPage, "sect/doc1") c.Assert(getPageDoc1En, qt.Equals, doc1en) c.Assert(getPageDoc1Fr, qt.Equals, doc1fr) c.Assert(getPageDoc1EnBase, qt.Equals, doc1en) @@ -321,7 +321,7 @@ func doTestMultiSitesBuild(t *testing.T, configTemplate, configSuffix string) { b.AssertFileContent("public/en/sect/doc1-slug/index.html", "Single", "Shortcode: Hello", "LingoDefault") // Check node translations - homeEn := enSite.getPage(page.KindHome) + homeEn := enSite.getPage(kinds.KindHome) c.Assert(homeEn, qt.Not(qt.IsNil)) c.Assert(len(homeEn.Translations()), qt.Equals, 3) c.Assert(homeEn.Translations()[0].Language().Lang, qt.Equals, "fr") @@ -331,7 +331,7 @@ func doTestMultiSitesBuild(t *testing.T, configTemplate, configSuffix string) { c.Assert(homeEn.Translations()[2].Title(), qt.Equals, "På bokmål") c.Assert(homeEn.Translations()[2].Language().LanguageName, qt.Equals, "Bokmål") - sectFr := frSite.getPage(page.KindSection, "sect") + sectFr := frSite.getPage(kinds.KindSection, "sect") c.Assert(sectFr, qt.Not(qt.IsNil)) c.Assert(sectFr.Language().Lang, qt.Equals, "fr") @@ -341,14 +341,14 @@ func doTestMultiSitesBuild(t *testing.T, configTemplate, configSuffix string) { nnSite := sites[2] c.Assert(nnSite.language.Lang, qt.Equals, "nn") - taxNn := nnSite.getPage(page.KindTaxonomy, "lag") + taxNn := nnSite.getPage(kinds.KindTaxonomy, "lag") c.Assert(taxNn, qt.Not(qt.IsNil)) c.Assert(len(taxNn.Translations()), qt.Equals, 1) c.Assert(taxNn.Translations()[0].Language().Lang, qt.Equals, "nb") - taxTermNn := nnSite.getPage(page.KindTerm, "lag", "sogndal") + taxTermNn := nnSite.getPage(kinds.KindTerm, "lag", "sogndal") c.Assert(taxTermNn, qt.Not(qt.IsNil)) - c.Assert(nnSite.getPage(page.KindTerm, "LAG", "SOGNDAL"), qt.Equals, taxTermNn) + c.Assert(nnSite.getPage(kinds.KindTerm, "LAG", "SOGNDAL"), qt.Equals, taxTermNn) c.Assert(len(taxTermNn.Translations()), qt.Equals, 1) c.Assert(taxTermNn.Translations()[0].Language().Lang, qt.Equals, "nb") @@ -379,19 +379,19 @@ func doTestMultiSitesBuild(t *testing.T, configTemplate, configSuffix string) { // Issue #3108 prevPage := enSite.RegularPages()[0].Prev() c.Assert(prevPage, qt.Not(qt.IsNil)) - c.Assert(prevPage.Kind(), qt.Equals, page.KindPage) + c.Assert(prevPage.Kind(), qt.Equals, kinds.KindPage) for { if prevPage == nil { break } - c.Assert(prevPage.Kind(), qt.Equals, page.KindPage) + c.Assert(prevPage.Kind(), qt.Equals, kinds.KindPage) prevPage = prevPage.Prev() } // Check bundles b.AssertFileContent("public/fr/bundles/b1/index.html", "RelPermalink: /blog/fr/bundles/b1/|") - bundleFr := frSite.getPage(page.KindPage, "bundles/b1/index.md") + bundleFr := frSite.getPage(kinds.KindPage, "bundles/b1/index.md") c.Assert(bundleFr, qt.Not(qt.IsNil)) c.Assert(len(bundleFr.Resources()), qt.Equals, 1) logoFr := bundleFr.Resources().GetMatch("logo*") @@ -401,7 +401,7 @@ func doTestMultiSitesBuild(t *testing.T, configTemplate, configSuffix string) { b.AssertFileContent("public/fr/bundles/b1/index.html", "Resources: image/png: /blog/fr/bundles/b1/logo.png") b.AssertFileContent("public/fr/bundles/b1/logo.png", "PNG Data") - bundleEn := enSite.getPage(page.KindPage, "bundles/b1/index.en.md") + bundleEn := enSite.getPage(kinds.KindPage, "bundles/b1/index.en.md") c.Assert(bundleEn, qt.Not(qt.IsNil)) b.AssertFileContent("public/en/bundles/b1/index.html", "RelPermalink: /blog/en/bundles/b1/|") c.Assert(len(bundleEn.Resources()), qt.Equals, 1) @@ -441,7 +441,7 @@ func TestMultiSitesRebuild(t *testing.T) { b.AssertFileContent("public/fr/sect/doc1/index.html", "Single", "Shortcode: Bonjour") b.AssertFileContent("public/en/sect/doc1-slug/index.html", "Single", "Shortcode: Hello") - homeEn := enSite.getPage(page.KindHome) + homeEn := enSite.getPage(kinds.KindHome) c.Assert(homeEn, qt.Not(qt.IsNil)) c.Assert(len(homeEn.Translations()), qt.Equals, 3) @@ -558,7 +558,7 @@ func TestMultiSitesRebuild(t *testing.T) { docFr := readWorkingDir(t, fs, "public/fr/sect/doc1/index.html") c.Assert(strings.Contains(docFr, "Salut"), qt.Equals, true) - homeEn := enSite.getPage(page.KindHome) + homeEn := enSite.getPage(kinds.KindHome) c.Assert(homeEn, qt.Not(qt.IsNil)) c.Assert(len(homeEn.Translations()), qt.Equals, 3) c.Assert(homeEn.Translations()[0].Language().Lang, qt.Equals, "fr") diff --git a/hugolib/hugo_sites_multihost_test.go b/hugolib/hugo_sites_multihost_test.go index 2aba5b593..a37310987 100644 --- a/hugolib/hugo_sites_multihost_test.go +++ b/hugolib/hugo_sites_multihost_test.go @@ -3,7 +3,7 @@ package hugolib import ( "testing" - "github.com/gohugoio/hugo/resources/page" + "github.com/gohugoio/hugo/resources/kinds" qt "github.com/frankban/quicktest" ) @@ -58,7 +58,7 @@ languageName = "Nynorsk" s1 := b.H.Sites[0] - s1h := s1.getPage(page.KindHome) + s1h := s1.getPage(kinds.KindHome) c.Assert(s1h.IsTranslated(), qt.Equals, true) c.Assert(len(s1h.Translations()), qt.Equals, 2) c.Assert(s1h.Permalink(), qt.Equals, "https://example.com/docs/") @@ -69,7 +69,7 @@ languageName = "Nynorsk" // For multihost, we never want any content in the root. // // check url in front matter: - pageWithURLInFrontMatter := s1.getPage(page.KindPage, "sect/doc3.en.md") + pageWithURLInFrontMatter := s1.getPage(kinds.KindPage, "sect/doc3.en.md") c.Assert(pageWithURLInFrontMatter, qt.Not(qt.IsNil)) c.Assert(pageWithURLInFrontMatter.RelPermalink(), qt.Equals, "/docs/superbob/") b.AssertFileContent("public/en/superbob/index.html", "doc3|Hello|en") @@ -86,7 +86,7 @@ languageName = "Nynorsk" s2 := b.H.Sites[1] - s2h := s2.getPage(page.KindHome) + s2h := s2.getPage(kinds.KindHome) c.Assert(s2h.Permalink(), qt.Equals, "https://example.fr/") // See https://github.com/gohugoio/hugo/issues/10912 @@ -104,7 +104,7 @@ languageName = "Nynorsk" // Check bundles - bundleEn := s1.getPage(page.KindPage, "bundles/b1/index.en.md") + bundleEn := s1.getPage(kinds.KindPage, "bundles/b1/index.en.md") c.Assert(bundleEn, qt.Not(qt.IsNil)) c.Assert(bundleEn.RelPermalink(), qt.Equals, "/docs/bundles/b1/") c.Assert(len(bundleEn.Resources()), qt.Equals, 1) @@ -112,7 +112,7 @@ languageName = "Nynorsk" b.AssertFileContent("public/en/bundles/b1/logo.png", "PNG Data") b.AssertFileContent("public/en/bundles/b1/index.html", " image/png: /docs/bundles/b1/logo.png") - bundleFr := s2.getPage(page.KindPage, "bundles/b1/index.md") + bundleFr := s2.getPage(kinds.KindPage, "bundles/b1/index.md") c.Assert(bundleFr, qt.Not(qt.IsNil)) c.Assert(bundleFr.RelPermalink(), qt.Equals, "/bundles/b1/") c.Assert(len(bundleFr.Resources()), qt.Equals, 1) diff --git a/hugolib/language_content_dir_test.go b/hugolib/language_content_dir_test.go index 05e207bbc..a22201475 100644 --- a/hugolib/language_content_dir_test.go +++ b/hugolib/language_content_dir_test.go @@ -20,10 +20,9 @@ import ( "path/filepath" "testing" + "github.com/gohugoio/hugo/resources/kinds" "github.com/spf13/cast" - "github.com/gohugoio/hugo/resources/page" - qt "github.com/frankban/quicktest" ) @@ -312,7 +311,7 @@ Content. b.AssertFileContent("public/sv/sect/mybundle/logo.png", "PNG Data") b.AssertFileContent("public/nn/sect/mybundle/logo.png", "PNG Data") - nnSect := nnSite.getPage(page.KindSection, "sect") + nnSect := nnSite.getPage(kinds.KindSection, "sect") c.Assert(nnSect, qt.Not(qt.IsNil)) c.Assert(len(nnSect.Pages()), qt.Equals, 12) nnHome := nnSite.Home() diff --git a/hugolib/page.go b/hugolib/page.go index 2644c8e4e..f8f966156 100644 --- a/hugolib/page.go +++ b/hugolib/page.go @@ -49,6 +49,7 @@ import ( "github.com/gohugoio/hugo/common/collections" "github.com/gohugoio/hugo/common/text" "github.com/gohugoio/hugo/resources" + "github.com/gohugoio/hugo/resources/kinds" "github.com/gohugoio/hugo/resources/page" "github.com/gohugoio/hugo/resources/resource" ) @@ -249,7 +250,7 @@ func (p *pageState) RegularPagesRecursive() page.Pages { p.regularPagesRecursiveInit.Do(func() { var pages page.Pages switch p.Kind() { - case page.KindSection: + case kinds.KindSection: pages = p.getPagesRecursive() default: pages = p.RegularPages() @@ -268,10 +269,10 @@ func (p *pageState) RegularPages() page.Pages { var pages page.Pages switch p.Kind() { - case page.KindPage: - case page.KindSection, page.KindHome, page.KindTaxonomy: + case kinds.KindPage: + case kinds.KindSection, kinds.KindHome, kinds.KindTaxonomy: pages = p.getPages() - case page.KindTerm: + case kinds.KindTerm: all := p.Pages() for _, p := range all { if p.IsPage() { @@ -293,15 +294,15 @@ func (p *pageState) Pages() page.Pages { var pages page.Pages switch p.Kind() { - case page.KindPage: - case page.KindSection, page.KindHome: + case kinds.KindPage: + case kinds.KindSection, kinds.KindHome: pages = p.getPagesAndSections() - case page.KindTerm: + case kinds.KindTerm: b := p.treeRef.n viewInfo := b.viewInfo taxonomy := p.s.Taxonomies()[viewInfo.name.plural].Get(viewInfo.termKey) pages = taxonomy.Pages() - case page.KindTaxonomy: + case kinds.KindTaxonomy: pages = p.bucket.getTaxonomies() default: pages = p.s.Pages() @@ -439,11 +440,11 @@ func (p *pageState) getLayoutDescriptor() layouts.LayoutDescriptor { sections := p.SectionsEntries() switch p.Kind() { - case page.KindSection: + case kinds.KindSection: if len(sections) > 0 { section = sections[0] } - case page.KindTaxonomy, page.KindTerm: + case kinds.KindTaxonomy, kinds.KindTerm: b := p.getTreeRef().n section = b.viewInfo.name.singular default: diff --git a/hugolib/page__data.go b/hugolib/page__data.go index 19b0154ad..ad6ba126e 100644 --- a/hugolib/page__data.go +++ b/hugolib/page__data.go @@ -16,6 +16,7 @@ package hugolib import ( "sync" + "github.com/gohugoio/hugo/resources/kinds" "github.com/gohugoio/hugo/resources/page" ) @@ -30,12 +31,12 @@ func (p *pageData) Data() any { p.dataInit.Do(func() { p.data = make(page.Data) - if p.Kind() == page.KindPage { + if p.Kind() == kinds.KindPage { return } switch p.Kind() { - case page.KindTerm: + case kinds.KindTerm: b := p.treeRef.n name := b.viewInfo.name termKey := b.viewInfo.termKey @@ -46,7 +47,7 @@ func (p *pageData) Data() any { p.data["Singular"] = name.singular p.data["Plural"] = name.plural p.data["Term"] = b.viewInfo.term() - case page.KindTaxonomy: + case kinds.KindTaxonomy: b := p.treeRef.n name := b.viewInfo.name |