hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit b2fcbb1f9774aa1e929b8575c0e1ac366ab2fb73
parent 3446fe9b8937610b8b628b2c212eb25888a7c1bb
Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Date:   Thu, 25 Jan 2018 09:37:05 +0100

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

Diffstat:
Moutput/layout.go | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/output/layout.go b/output/layout.go
@@ -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