add pre/post event changes

archetype-theme-transition
Ryan Holder 3 years ago
parent 6f7bfaaa09
commit 68886e94e3

@ -5,9 +5,19 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<h1 class="section-header my-3 my-md-5 pb-2 text-center">{{ .Title }}</h1> <h1 class="section-header my-3 my-md-5 pb-2 text-center">{{ .Title }}</h1>
{{ $.Scratch.Set "pre" true }}
{{ $.Scratch.Set "post" true }}
{{ range .Pages.ByDate.Reverse }} {{ range .Pages.ByDate.Reverse }}
{{ $eventdate := .Param "eventdate" }} {{ $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"> <article class="post__article row">
<div class="col-md-6 pt-3 mb-3 mb-lg-0"> <div class="col-md-6 pt-3 mb-3 mb-lg-0">
{{ if .Param "image" }} {{ if .Param "image" }}
@ -28,7 +38,13 @@
<b>{{ .Param "eventcalendar" }}</b> <b>{{ .Param "eventcalendar" }}</b>
</p> </p>
<p>{{ .Content }}</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> </div>
</article> </article>
{{ end }} {{ end }}

Loading…
Cancel
Save