Paginating future content (events)

You could even do it without Scratch:

{{ $future_content := slice }}

{{ $date_format := "2006-01-02T15:04:05" }}

{{ range where .Site.RegularPages "Section" "events" }}
  {{ $formatted_start := (time .Params.start).Format $date_format }}
  {{ $formatted_now := now.Format $date_format }}

  {{ if ge $formatted_start $formatted_now }}
    {{ $future_content = $future_content | append . }}
  {{ end }}
{{ end }}

{{ range $future_content }}
  {{ . }}
{{ end }}

Then replace that last range with your pageinator code.

1 Like