It is hiding the events older than today but the problem is that it keeps 8 items in the pagination when a post is older than today. It is hidden but the array (?) for pagination keeps this item so it only displays 7 items and so on when new events become older than today.
Is there a way to make this filtering at the paginator level and pull the items older than today out of the pagination instead of hiding it ?
{{/* Create slice of pages. */}}
{{ $p := slice }}
{{ range where site.RegularPages "Section" "actu" }}
{{ if (.Params.event_time | time.AsTime).Before now }}
{{ $p = $p | append . }}
{{ end }}
{{ end }}
{{ $p = sort $p "Params.event_time" "asc" }}
{{/* Render links. */}}
{{ range (.Paginate $p).Pages }}
<h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
{{ end }}
{{/* Render navigation. */}}
{{ template "_internal/pagination.html" . }}
Note that we’re sorting by event_time as a string, not a time.Time value. This could be incorrect if the event_time format is inconsistent in front matter.
Again, this would be much simpler if the front matter were TOML, and the event_time unquoted, because TOML dates are unmarshalled to time.Time values.