diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-12-17 10:47:11 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-12-17 11:34:32 +0100 |
commit | d5a0b6bbbc83a3e274c62ed397a293f04ee8d241 (patch) | |
tree | 2ff65eb4f678f08c5453b4fcf5ab4be59e793df9 /hugolib | |
parent | 5178cd13a7da3c5f5ec5d3217c9e40fc0be7152a (diff) |
hugolib: Remove "double layout" lookup
Fixes #5390
Diffstat (limited to 'hugolib')
-rw-r--r-- | hugolib/hugo_sites.go | 2 | ||||
-rw-r--r-- | hugolib/site.go | 30 | ||||
-rw-r--r-- | hugolib/site_render.go | 6 |
3 files changed, 4 insertions, 34 deletions
diff --git a/hugolib/hugo_sites.go b/hugolib/hugo_sites.go index c1fa7979c..a211956df 100644 --- a/hugolib/hugo_sites.go +++ b/hugolib/hugo_sites.go @@ -486,7 +486,7 @@ func (h *HugoSites) renderCrossSitesArtifacts() error { smLayouts := []string{"sitemapindex.xml", "_default/sitemapindex.xml", "_internal/_default/sitemapindex.xml"} return s.renderAndWriteXML(&s.PathSpec.ProcessingStats.Sitemaps, "sitemapindex", - sitemapDefault.Filename, h.toSiteInfos(), s.appendThemeTemplates(smLayouts)...) + sitemapDefault.Filename, h.toSiteInfos(), smLayouts...) } func (h *HugoSites) assignMissingTranslations() error { diff --git a/hugolib/site.go b/hugolib/site.go index cf8b3a28d..2fd9f17ee 100644 --- a/hugolib/site.go +++ b/hugolib/site.go @@ -1648,36 +1648,6 @@ func (s *Site) errorCollator(results <-chan error, errs chan<- error) { close(errs) } -func (s *Site) appendThemeTemplates(in []string) []string { - if !s.PathSpec.ThemeSet() { - return in - } - - out := []string{} - // First place all non internal templates - for _, t := range in { - if !strings.HasPrefix(t, "_internal/") { - out = append(out, t) - } - } - - // Then place theme templates with the same names - for _, t := range in { - if !strings.HasPrefix(t, "_internal/") { - out = append(out, "theme/"+t) - } - } - - // Lastly place internal templates - for _, t := range in { - if strings.HasPrefix(t, "_internal/") { - out = append(out, t) - } - } - return out - -} - // GetPage looks up a page of a given type for the given ref. // In Hugo <= 0.44 you had to add Page Kind (section, home) etc. as the first // argument and then either a unix styled path (with or without a leading slash)) diff --git a/hugolib/site_render.go b/hugolib/site_render.go index a8cdca255..4ce2b4c53 100644 --- a/hugolib/site_render.go +++ b/hugolib/site_render.go @@ -303,7 +303,7 @@ func (s *Site) render404() error { s.Log.ERROR.Printf("Failed to create target path for page %q: %s", p, err) } - return s.renderAndWritePage(&s.PathSpec.ProcessingStats.Pages, "404 page", targetPath, pageOutput, s.appendThemeTemplates(nfLayouts)...) + return s.renderAndWritePage(&s.PathSpec.ProcessingStats.Pages, "404 page", targetPath, pageOutput, nfLayouts...) } func (s *Site) renderSitemap() error { @@ -354,7 +354,7 @@ func (s *Site) renderSitemap() error { addLanguagePrefix := n.Site.IsMultiLingual() return s.renderAndWriteXML(&s.PathSpec.ProcessingStats.Sitemaps, "sitemap", - n.addLangPathPrefixIfFlagSet(page.Sitemap.Filename, addLanguagePrefix), n, s.appendThemeTemplates(smLayouts)...) + n.addLangPathPrefixIfFlagSet(page.Sitemap.Filename, addLanguagePrefix), n, smLayouts...) } func (s *Site) renderRobotsTXT() error { @@ -385,7 +385,7 @@ func (s *Site) renderRobotsTXT() error { s.Log.ERROR.Printf("Failed to create target path for page %q: %s", p, err) } - return s.renderAndWritePage(&s.PathSpec.ProcessingStats.Pages, "Robots Txt", targetPath, pageOutput, s.appendThemeTemplates(rLayouts)...) + return s.renderAndWritePage(&s.PathSpec.ProcessingStats.Pages, "Robots Txt", targetPath, pageOutput, rLayouts...) } |