mirror of
https://github.com/gohugoio/hugo.git
synced 2025-09-01 22:42:45 +02:00
hugolib: Fix output format handling of mix cased page kinds
Fixes #4528
This commit is contained in:
@@ -13,6 +13,8 @@
|
||||
|
||||
package page
|
||||
|
||||
import "strings"
|
||||
|
||||
const (
|
||||
KindPage = "page"
|
||||
|
||||
@@ -23,3 +25,16 @@ const (
|
||||
KindTaxonomy = "taxonomy"
|
||||
KindTaxonomyTerm = "taxonomyTerm"
|
||||
)
|
||||
|
||||
var kindMap = map[string]string{
|
||||
strings.ToLower(KindPage): KindPage,
|
||||
strings.ToLower(KindHome): KindHome,
|
||||
strings.ToLower(KindSection): KindSection,
|
||||
strings.ToLower(KindTaxonomy): KindTaxonomy,
|
||||
strings.ToLower(KindTaxonomyTerm): KindTaxonomyTerm,
|
||||
}
|
||||
|
||||
// GetKind gets the page kind given a string, empty if not found.
|
||||
func GetKind(s string) string {
|
||||
return kindMap[strings.ToLower(s)]
|
||||
}
|
||||
|
Reference in New Issue
Block a user