Hello,
I’m on a mission to learn how to “do” websites. I’m normally an embedded engineer. Hugo seemed interesting enough for what I wanted to do and exposed me to lots of things so I picked it. I’ve been having a great time! It feels good to use. Until I got this error:
ERROR error building site: render: [en v1.0.0 guest] failed to render pages: render of “/mnt/usb/Websites/PersonalBlog/content/_index.md” failed: “/mnt/usb/Websites/PersonalBlog/themes/artsy/layouts/baseof.html:11:19”: execute of template failed: template: _partials/gallery.html:11:19: executing “gallery” at <partial “card.html” .>: error calling partial: “/mnt/usb/Websites/PersonalBlog/themes/artsy/layouts/_partials/card.html:5:9”: execute of template failed: template: _partials/card.html:5:9: executing “_partials/card.html” at <.Ordinal>: can’t evaluate field Ordinal in type *hugolib.pageState
I’ve been googling this for a few days and I’ve tried to follow other forum posts but they don’t seem to be my issue.
Here’s the repo: GitHub - carterembedded/hugo-artsy: A galleried hugo theme for writers and media creators
Specifically the issue is in the files: partials/card.html, partials/gallery.html, {home,section}.html
in card.html I have:
{{ $type := partial "card_type" . }}
{{ $blog := .Site.Params.postTypes.Blog }}
{{ $gallery := .Site.Params.postTypes.Gallery }}
{{ $i := .Ordinal }}
<article class="
card h-100
{{ if modBool $i 7 }} tall {{ end }}
{{ if modBool $i 5 }} wide {{ end }}
">
{{ if ( eq $type $blog ) }}
{{ .Summary }}
{{ end }}
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
{{ if .Params.Image }}
<a href="{{ .RelPermalink }}" class="thumbnail">
<img src={{ .Params.Image }}/>
</a>
{{ end }}
Which is called in gallery.html like this:
{{/* Here we want to define how our gallery behaves and looks */}}
{{/* Then we use this partial in home.html and the gallery. Both will have slightly different behaviour */}}
{{ define "gallery" }}
{{ $type := partial "card_type" . }}
{{ $blog := .Site.Params.postTypes.Blog }}
{{ $gallery := .Site.Params.postTypes.Gallery }}
<div class="container">
<div class="gallery-grid">
{{ $entries := where .Site.RegularPages "Params.comment" $type }}
{{ range $entries }}
{{ partial "card.html" . }}
{{ end }}
<div>
</div>
{{ end }}
I am completely stuck. I just can’t progress… I’m running:
hugo v0.155.3+extended+withdeploy linux/amd64 BuildDate=unknown
GOOS="linux"
GOARCH="amd64"
GOVERSION="go1.25.6"
github.com/webmproject/libwebp="v1.6.0"
github.com/sass/libsass="3.6.6"
If I can provide anything else I will. Thank you in advance!