mirror of
https://github.com/gohugoio/hugo.git
synced 2025-02-02 06:41:26 +00:00
Fix template checking order in site.go
- Change order of HasPrefix to match correct order - Remove theme concatenation to _internal in last loop of appendthemetemplates so it looks in the right place for internal templates Conflicts: hugolib/site.go
This commit is contained in:
parent
55fcd2f30f
commit
b716dbec1d
1 changed files with 6 additions and 4 deletions
|
@ -766,21 +766,22 @@ func (s *Site) appendThemeTemplates(in []string) []string {
|
||||||
out := []string{}
|
out := []string{}
|
||||||
// First place all non internal templates
|
// First place all non internal templates
|
||||||
for _, t := range in {
|
for _, t := range in {
|
||||||
if !strings.HasPrefix("_internal/", t) {
|
if !strings.HasPrefix(t, "_internal/") {
|
||||||
out = append(out, t)
|
out = append(out, t)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Then place theme templates with the same names
|
// Then place theme templates with the same names
|
||||||
for _, t := range in {
|
for _, t := range in {
|
||||||
if !strings.HasPrefix("_internal/", t) {
|
if !strings.HasPrefix(t, "_internal/") {
|
||||||
out = append(out, "theme/"+t)
|
out = append(out, "theme/"+t)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lastly place internal templates
|
// Lastly place internal templates
|
||||||
for _, t := range in {
|
for _, t := range in {
|
||||||
if strings.HasPrefix("_internal/", t) {
|
if strings.HasPrefix(t, "_internal/") {
|
||||||
out = append(out, "theme/"+t)
|
out = append(out, t)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return out
|
return out
|
||||||
|
@ -936,6 +937,7 @@ func (s *Site) RenderSectionLists() error {
|
||||||
|
|
||||||
if !viper.GetBool("DisableRSS") {
|
if !viper.GetBool("DisableRSS") {
|
||||||
// XML Feed
|
// XML Feed
|
||||||
|
fmt.Println("Section...")
|
||||||
rssLayouts := []string{"section/" + section + ".rss.xml", "_default/rss.xml", "rss.xml", "_internal/_default/rss.xml"}
|
rssLayouts := []string{"section/" + section + ".rss.xml", "_default/rss.xml", "rss.xml", "_internal/_default/rss.xml"}
|
||||||
s.setUrls(n, section+".xml")
|
s.setUrls(n, section+".xml")
|
||||||
b, err = s.renderXML("section "+section+" rss", n, s.appendThemeTemplates(rssLayouts)...)
|
b, err = s.renderXML("section "+section+" rss", n, s.appendThemeTemplates(rssLayouts)...)
|
||||||
|
|
Loading…
Reference in a new issue