add pre/post event changes

newmemberlevels
Ryan Holder 3 years ago
parent 6f7bfaaa09
commit 68886e94e3

@ -5,9 +5,19 @@
<div class="container">
<div class="row">
<h1 class="section-header my-3 my-md-5 pb-2 text-center">{{ .Title }}</h1>
{{ range .Pages.ByDate.Reverse }}
{{ $eventdate := .Param "eventdate" }}
{{ $.Scratch.Set "pre" true }}
{{ $.Scratch.Set "post" true }}
{{ range .Pages.ByDate.Reverse }}
{{ $eventdate := .Param "eventdate" }}
{{ $t := (time $eventdate)}}
{{ if and ($t.After now) ( $.Scratch.Get "pre")}}
<h2>Upcoming Events</h2>
{{ $.Scratch.Set "pre" false }}
{{ end }}
{{ if and ($t.Before now) ($.Scratch.Get "post")}}
<h2>Past Events</h2>
{{ $.Scratch.Set "post" false }}
{{ end }}
<article class="post__article row">
<div class="col-md-6 pt-3 mb-3 mb-lg-0">
{{ if .Param "image" }}
@ -28,7 +38,13 @@
<b>{{ .Param "eventcalendar" }}</b>
</p>
<p>{{ .Content }}</p>
<p><a class="btn-outline-primary btn-sm btn" href="{{ .Param "link" }}">Registration</a></p>
<p>
{{ if and ($t.After now) }}
<a class="btn-outline-primary btn-sm btn" href="{{ .Param "link" }}">Registration</a>
{{ else }}
<a class="btn-outline-primary btn-sm btn" href="{{ .Param " link" }}">Access event content</a>
{{ end }}
</p>
</div>
</article>
{{ end }}

Loading…
Cancel
Save