summaryrefslogtreecommitdiffstats
path: root/common/hreflect/helpers.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2025-02-07 10:29:35 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2025-02-08 10:31:15 +0100
commitc2fb22120924b66ba6d89dacca6487ff12e78e0f (patch)
tree93e98c6f9929b8b759a71a25dbcda15c84f88a1e /common/hreflect/helpers.go
parent4245a4514d58c0896900bc242390b31e92005d43 (diff)
downloadhugo-c2fb22120924b66ba6d89dacca6487ff12e78e0f.tar.gz
hugo-c2fb22120924b66ba6d89dacca6487ff12e78e0f.zip
Add ContentTypes to config
This is an empty struct for now, but we will most likely expand on that. ``` [contentTypes] [contentTypes.'text/markdown'] ``` The above means that only Markdown will be considered a content type. E.g. HTML will be treated as plain text. Fixes #12274
Diffstat (limited to 'common/hreflect/helpers.go')
-rw-r--r--common/hreflect/helpers.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/common/hreflect/helpers.go b/common/hreflect/helpers.go
index fc83165c7..4d7339b5b 100644
--- a/common/hreflect/helpers.go
+++ b/common/hreflect/helpers.go
@@ -74,6 +74,16 @@ func IsTruthful(in any) bool {
}
}
+// IsMap reports whether v is a map.
+func IsMap(v any) bool {
+ return reflect.ValueOf(v).Kind() == reflect.Map
+}
+
+// IsSlice reports whether v is a slice.
+func IsSlice(v any) bool {
+ return reflect.ValueOf(v).Kind() == reflect.Slice
+}
+
var zeroType = reflect.TypeOf((*types.Zeroer)(nil)).Elem()
// IsTruthfulValue returns whether the given value has a meaningful truth value.