output: Remove duplicate layout lookup layouts

This can happen for sections if Type and Section are equal.

Of no real practical difference, but it makes the docs less confusing.

Fixes #4319
This commit is contained in:
Bjørn Erik Pedersen 2018-01-25 09:37:05 +01:00
parent 3446fe9b89
commit b2fcbb1f97
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F

View file

@ -17,6 +17,8 @@ import (
"fmt"
"strings"
"sync"
"github.com/gohugoio/hugo/helpers"
)
// These may be used as content sections with potential conflicts. Avoid that.
@ -95,6 +97,7 @@ func (l *LayoutHandler) For(d LayoutDescriptor, f Format) ([]string, error) {
}
layouts = prependTextPrefixIfNeeded(f, layouts...)
layouts = helpers.UniqueStrings(layouts)
l.mu.Lock()
l.cache[key] = layouts