mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
parent
e1becf1dfe
commit
5f667f8796
2 changed files with 9 additions and 1 deletions
|
@ -560,7 +560,7 @@ func (m *pageMap) getOrCreateResourcesForPage(ps *pageState) resource.Resources
|
||||||
for _, r := range res2 {
|
for _, r := range res2 {
|
||||||
var found bool
|
var found bool
|
||||||
for _, r2 := range res {
|
for _, r2 := range res {
|
||||||
if r2.(resource.NameNormalizedProvider).NameNormalized() == r.(resource.NameNormalizedProvider).NameNormalized() {
|
if resource.NameNormalizedOrName(r2) == resource.NameNormalizedOrName(r) {
|
||||||
found = true
|
found = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
|
@ -298,3 +298,11 @@ func (r resourceTypesHolder) ResourceType() string {
|
||||||
func NewResourceTypesProvider(mediaType media.Type, resourceType string) ResourceTypesProvider {
|
func NewResourceTypesProvider(mediaType media.Type, resourceType string) ResourceTypesProvider {
|
||||||
return resourceTypesHolder{mediaType: mediaType, resourceType: resourceType}
|
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()
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue