diff --git a/hugolib/content_map_page.go b/hugolib/content_map_page.go index e3b29f186..c3f06a592 100644 --- a/hugolib/content_map_page.go +++ b/hugolib/content_map_page.go @@ -560,7 +560,7 @@ func (m *pageMap) getOrCreateResourcesForPage(ps *pageState) resource.Resources for _, r := range res2 { var found bool for _, r2 := range res { - if r2.(resource.NameNormalizedProvider).NameNormalized() == r.(resource.NameNormalizedProvider).NameNormalized() { + if resource.NameNormalizedOrName(r2) == resource.NameNormalizedOrName(r) { found = true break } 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() +}