diff options
Diffstat (limited to 'hugolib/site_render.go')
-rw-r--r-- | hugolib/site_render.go | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/hugolib/site_render.go b/hugolib/site_render.go index f105a1ae4..f076b98dd 100644 --- a/hugolib/site_render.go +++ b/hugolib/site_render.go @@ -20,6 +20,8 @@ import ( "strings" "sync" + "github.com/gohugoio/hugo/output/layouts" + "github.com/gohugoio/hugo/config" "github.com/gohugoio/hugo/tpl" @@ -77,6 +79,7 @@ func (s *Site) renderPages(ctx *siteRenderContext) error { cfg := ctx.cfg s.pageMap.pageTrees.Walk(func(ss string, n *contentNode) bool { + if cfg.shouldRender(n.p) { select { case <-s.h.Done(): @@ -183,7 +186,7 @@ func (s *Site) logMissingLayout(name, layout, kind, outputFormat string) { // renderPaginator must be run after the owning Page has been rendered. func (s *Site) renderPaginator(p *pageState, templ tpl.Template) error { - paginatePath := s.Cfg.GetString("paginatePath") + paginatePath := s.conf.PaginatePath d := p.targetPathDescriptor f := p.s.rc.Format @@ -240,7 +243,7 @@ func (s *Site) render404() error { return nil } - var d output.LayoutDescriptor + var d layouts.LayoutDescriptor d.Kind = kind404 templ, found, err := s.Tmpl().LookupLayout(d, output.HTMLFormat) @@ -265,7 +268,7 @@ func (s *Site) renderSitemap() error { s: s, kind: kindSitemap, urlPaths: pagemeta.URLPath{ - URL: s.siteCfg.sitemap.Filename, + URL: s.conf.Sitemap.Filename, }, }, output.HTMLFormat, @@ -291,7 +294,7 @@ func (s *Site) renderSitemap() error { } func (s *Site) renderRobotsTXT() error { - if !s.Cfg.GetBool("enableRobotsTXT") { + if !s.conf.EnableRobotsTXT && s.isEnabled(kindRobotsTXT) { return nil } @@ -355,13 +358,13 @@ func (s *Site) renderAliases() error { a = path.Join(f.Path, a) } - if s.UglyURLs && !strings.HasSuffix(a, ".html") { + if s.conf.C.IsUglyURLSection(p.Section()) && !strings.HasSuffix(a, ".html") { a += ".html" } lang := p.Language().Lang - if s.h.multihost && !strings.HasPrefix(a, "/"+lang) { + if s.h.Configs.IsMultihost && !strings.HasPrefix(a, "/"+lang) { // These need to be in its language root. a = path.Join(lang, a) } @@ -381,16 +384,16 @@ func (s *Site) renderAliases() error { // renderMainLanguageRedirect creates a redirect to the main language home, // depending on if it lives in sub folder (e.g. /en) or not. func (s *Site) renderMainLanguageRedirect() error { - if !s.h.multilingual.enabled() || s.h.IsMultihost() { + if !s.h.isMultiLingual() || s.h.Conf.IsMultihost() { // No need for a redirect return nil } - html, found := s.outputFormatsConfig.GetByName("HTML") + html, found := s.conf.OutputFormats.Config.GetByName("html") if found { - mainLang := s.h.multilingual.DefaultLang - if s.Info.defaultContentLanguageInSubdir { - mainLangURL := s.PathSpec.AbsURL(mainLang.Lang+"/", false) + mainLang := s.conf.DefaultContentLanguage + if s.conf.DefaultContentLanguageInSubdir { + mainLangURL := s.PathSpec.AbsURL(mainLang+"/", false) s.Log.Debugf("Write redirect to main language %s: %s", mainLang, mainLangURL) if err := s.publishDestAlias(true, "/", mainLangURL, html, nil); err != nil { return err @@ -398,7 +401,7 @@ func (s *Site) renderMainLanguageRedirect() error { } else { mainLangURL := s.PathSpec.AbsURL("", false) s.Log.Debugf("Write redirect to main language %s: %s", mainLang, mainLangURL) - if err := s.publishDestAlias(true, mainLang.Lang, mainLangURL, html, nil); err != nil { + if err := s.publishDestAlias(true, mainLang, mainLangURL, html, nil); err != nil { return err } } |