hugolib: Fix output format handling of mix cased page kinds

Fixes #4528
This commit is contained in:
Bjørn Erik Pedersen
2019-08-05 10:19:55 +02:00
parent 9ef4dca361
commit de87624241
5 changed files with 85 additions and 23 deletions

View File

@@ -14,6 +14,8 @@
package hugolib
import (
"strings"
"github.com/gohugoio/hugo/resources/page"
)
@@ -38,3 +40,17 @@ const (
pageResourceType = "page"
)
var kindMap = map[string]string{
strings.ToLower(kindRSS): kindRSS,
strings.ToLower(kindSitemap): kindSitemap,
strings.ToLower(kindRobotsTXT): kindRobotsTXT,
strings.ToLower(kind404): kind404,
}
func getKind(s string) string {
if pkind := page.GetKind(s); pkind != "" {
return pkind
}
return kindMap[strings.ToLower(s)]
}