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:
Bjørn Erik Pedersen
2017-03-26 19:34:30 +02:00
parent e49a2b83ad
commit 930a3df1b7
6 changed files with 50 additions and 16 deletions

View File

@@ -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)
}
}