mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-27 14:10:31 +03:00
tpl: Fix layout fall back logic when layout is set in front matter but not found
Fixes #13630
This commit is contained in:
parent
1408c156d8
commit
5e62cc6fce
2 changed files with 26 additions and 5 deletions
|
@ -94,14 +94,10 @@ func (this TemplateDescriptor) doCompare(category Category, isEmbedded bool, oth
|
||||||
}
|
}
|
||||||
|
|
||||||
if other.LayoutFromTemplate != "" && other.LayoutFromTemplate != layoutAll {
|
if other.LayoutFromTemplate != "" && other.LayoutFromTemplate != layoutAll {
|
||||||
if this.LayoutFromUser == "" {
|
if this.LayoutFromUser == "" || this.LayoutFromUser != other.LayoutFromTemplate {
|
||||||
if other.LayoutFromTemplate != this.LayoutFromTemplate {
|
if other.LayoutFromTemplate != this.LayoutFromTemplate {
|
||||||
return w
|
return w
|
||||||
}
|
}
|
||||||
} else if isLayoutStandard(this.LayoutFromUser) {
|
|
||||||
if other.LayoutFromTemplate != this.LayoutFromUser {
|
|
||||||
return w
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1245,3 +1245,28 @@ p: {{ partial "p.html" . }}
|
||||||
b.Assert(err, qt.IsNotNil)
|
b.Assert(err, qt.IsNotNil)
|
||||||
b.Assert(err.Error(), qt.Contains, "error calling partial: maximum template call stack size exceeded")
|
b.Assert(err.Error(), qt.Contains, "error calling partial: maximum template call stack size exceeded")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestIssue13630(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
files := `
|
||||||
|
-- hugo.toml --
|
||||||
|
disableKinds = ['rss','sitemap']
|
||||||
|
-- content/p1.md --
|
||||||
|
---
|
||||||
|
title: p1
|
||||||
|
layout: foo
|
||||||
|
---
|
||||||
|
-- layouts/list.html --
|
||||||
|
layouts/list.html
|
||||||
|
-- layouts/taxononmy.html.html --
|
||||||
|
layouts/taxononmy.html.html
|
||||||
|
`
|
||||||
|
|
||||||
|
var b *hugolib.IntegrationTestBuilder
|
||||||
|
|
||||||
|
for range 3 {
|
||||||
|
b = hugolib.Test(t, files)
|
||||||
|
b.AssertFileExists("public/p1/index.html", false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue