+++
date = "2015-10-30"
[[event]]
date = "2015-10-05"
title = "event title"
category = "taxonmy_name3"
[[event]]
date = "2015-10-02"
title = "event2 title"
category = "taxonmy_name3"
summary = """
Some Copy about the event"""
[[event]]
date = "2015-10-06"
title = "event3 title"
category = "taxonmy_name3"
+++
Some copy about the month's events
I’ve set this up because it’s easy for content creators to make a list of events for each month. I’m attempting to pull in the entries, date-based, but also the events within each month, date-based, as well as taxonomies.
Is this possible? So far, I’ve managed to display the months with their events, but not to display only upcoming (front matter-based) events.
// Loop through all events content
{{ range where .Data.Pages.ByDate "Section" "events" }}
// Only show events entries that are in the future
{{ if ge .Date.Unix .Now.Unix }}
// Only show events entries that have an event in their front matter
{{ if isset .Params "event" }}
<h2>{{ .Date.Format "January" }} {{ .Type | title }}</h2>
<ul id="tags">
// loop through front-matter-based events
{{ range .Params.event }}
// THIS IS WHERE I'M STUCK
{{ if ge .event.date.Unix .Now.Unix }}
<li style="margin-bottom:3em;">
{{ .date | dateFormat "Monday, Jan 2, 2006" }}
{{ if .title }}
{{ .title | markdownify }}
{{ end }}
{{ if .summary }}
{{ .summary | markdownify }}
{{ end }}
</li>
{{ end }}
{{ end }}
</ul>
{{end }}
{{ end }}
{{ end }}
So what I thought someone would say when I posted this was “No, you can’t do that with dates in front matter.” or “sure, you can do that, you’re just writing it wrong.” So barring either of those two responses, I suppose there’s some potential for this? I’ll just keep at it then.