summaryrefslogtreecommitdiffstats
path: root/hugolib/page_kinds.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2019-08-05 10:19:55 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2019-08-05 11:22:03 +0200
commitde87624241daa86660f205cc72a745409b9c9238 (patch)
tree361e6ae2c801bd400bf9d1de8c9fda64c5750dca /hugolib/page_kinds.go
parent9ef4dca361727a78e0f66f8f4e54c64e4c4781cb (diff)
hugolib: Fix output format handling of mix cased page kinds
Fixes #4528
Diffstat (limited to 'hugolib/page_kinds.go')
-rw-r--r--hugolib/page_kinds.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/hugolib/page_kinds.go b/hugolib/page_kinds.go
index 39de31a16..6b6a00c5f 100644
--- a/hugolib/page_kinds.go
+++ b/hugolib/page_kinds.go
@@ -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)]
+}