aboutsummaryrefslogtreecommitdiffhomepage
path: root/resources
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2024-08-25 22:51:38 +0200
committerBjørn Erik Pedersen <[email protected]>2024-08-25 23:17:26 +0200
commit5f667f8796fb051e110449dd8d775e947cc1801e (patch)
tree1aa808b802c98ee568e9c1b1369532aca1204672 /resources
parente1becf1dfe31bec65eca585ac66a2d10f1651e42 (diff)
downloadhugo-5f667f8796fb051e110449dd8d775e947cc1801e.tar.gz
hugo-5f667f8796fb051e110449dd8d775e947cc1801e.zip
Fix missing method NameNormalized panic
Closes #12795
Diffstat (limited to 'resources')
-rw-r--r--resources/resource/resourcetypes.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/resources/resource/resourcetypes.go b/resources/resource/resourcetypes.go
index 8d982b00a..0fb87f371 100644
--- a/resources/resource/resourcetypes.go
+++ b/resources/resource/resourcetypes.go
@@ -298,3 +298,11 @@ func (r resourceTypesHolder) ResourceType() string {
func NewResourceTypesProvider(mediaType media.Type, resourceType string) ResourceTypesProvider {
return resourceTypesHolder{mediaType: mediaType, resourceType: resourceType}
}
+
+// NameNormalizedOrName returns the normalized name if available, otherwise the name.
+func NameNormalizedOrName(r Resource) string {
+ if nn, ok := r.(NameNormalizedProvider); ok {
+ return nn.NameNormalized()
+ }
+ return r.Name()
+}