mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-25 22:00:58 +02:00
hugolib, output: Restrict Render to regular Pages
Using it for list pages doesn't work and has potential weird side-effects. The user probably meant to range over .Site.ReqularPages, and that is now marked clearly in the log.
This commit is contained in:
@@ -68,8 +68,9 @@ func TestLayout(t *testing.T) {
|
||||
t.Run(this.name, func(t *testing.T) {
|
||||
l := NewLayoutHandler(this.hasTheme)
|
||||
|
||||
layouts := l.For(this.d, this.layoutOverride, this.tp)
|
||||
layouts, err := l.For(this.d, this.layoutOverride, this.tp)
|
||||
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, layouts)
|
||||
require.True(t, len(layouts) >= len(this.expect))
|
||||
// Not checking the complete list for now ...
|
||||
@@ -83,6 +84,10 @@ func TestLayout(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
l := NewLayoutHandler(false)
|
||||
_, err := l.For(LayoutDescriptor{Kind: "taxonomyTerm", Section: "tag"}, "override", RSSFormat)
|
||||
require.Error(t, err)
|
||||
|
||||
}
|
||||
|
||||
func BenchmarkLayout(b *testing.B) {
|
||||
@@ -90,7 +95,8 @@ func BenchmarkLayout(b *testing.B) {
|
||||
l := NewLayoutHandler(false)
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
layouts := l.For(descriptor, "", HTMLFormat)
|
||||
layouts, err := l.For(descriptor, "", HTMLFormat)
|
||||
require.NoError(b, err)
|
||||
require.NotEmpty(b, layouts)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user