I’m getting this error below when I use the same photo
params in both translated content. Is there a way to omit the photo params in the French version and tell Hugo to use the one in the English version? or is there a better way to tackle this? Thanks in advance.
By the way, everything works OK if I delete post1.fr.md
, so I’m guessing the duplicated params is causing the issue.
content/posts/post1.en.md
---
title: "Post title - English"
photo: "/uploads/post1-image.jpg"
---
content/posts/post1.fr.md
---
title: "Titre de l'article - Francais"
photo: "/uploads/post1-image.jpg"
---
single.html
{{ with .Params.photo }}
{{ $imageResource := ($.Site.GetPage "section" "uploads").Resources.GetMatch (strings.TrimPrefix "/uploads/" . ) }}
{{ $resized := $imageResource.Fill "300x450 Top q90" }}
<img src="{{ $resized.RelPermalink }}" alt="{{ $.Title }}" />
{{ end }}
Here is the error I’m getting:
execute of template failed: template: contestants/single.html:7:49: executing "main" at <$imageResource.Fill>: nil pointer evaluating resource.Resource.Fill