-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Closed
Description
I recently upgraded from an old version (in the 0.50's I think) and have noticed a problem with a template that does a filter against some data that's in TOML using dates.
I have items such as the following:
{ date = 2022-06-20, name = "End to end GraphQL (workshop)", link = "https://ndcmelbourne.com/agenda/end-to-end-graphql/daba56ef9e98", event = "NDC Melbourne 2022" },
And use it in a template like so:
{{ if .Site.Params.speaking.enable }} {{ with .Site.Params.speaking }}
<section id="speaking" class="container">
<div>
<h2>{{ .title }}</h2>
{{ $talks := where .talks "date" ">" now }} {{ if eq (len $talks) 0 }}
<p>{{ .noTalks }}</p>
{{ else }}
<ul class="talk-list">
{{ range sort $talks "date" "asc" }}
<li>
{{ partial "talk" . }}
</li>
{{ end }}
</ul>
{{ end }}
</div>
<div>
<p>{{ .content }}</p>
<h3>
<a href="/talks/" title="Available Talks">My Available Talks</a>
</h3>
</div>
</section>
{{ end }} {{ end }}
Upon upgrading to the latest version, the where
condition no longer works, I'm assuming because the two types (the TOML date and now
) can no longer be compared.
Repo containing the full code is here: https://github.com/aaronpowell/aaronpowell.github.io
Relevant files are:
- TOML: https://github.com/aaronpowell/aaronpowell.github.io/blob/main/src/config.speaking.toml
- Template: https://github.com/aaronpowell/aaronpowell.github.io/blob/main/src/themes/aaronpowell/layouts/partials/speaking.html
What version of Hugo are you using (hugo version
)?
$ hugo version hugo v0.100.1-0afb4866e345d31cbbcbab4349e43f1d36122806+extended linux/amd64 BuildDate=2022-06-01T10:11:48Z VendorInfo=gohugoio
Does this issue reproduce with the latest release?
Yes.