Hello,
I’m creating my second website with Hugo !
I’m facing a problem with a specific need, my blog is about events. In the home page, I want to display events that will come and those that have came yet.
WELCOME
Next events
Event1, Event2, Event3
Past event
Event4
I set a param in the events content : past=[yes|no]
Here is all I have for now :
My index.html
{{ partial "header.html" . }}
<body>
{{ partial "navbar.html" . }}
{{ partial "breadcrumb.html" . }}
<div class="wrapper">
<div id="tiles-wrapper">
{{ range (where .Site.Pages "Section" "evenements") }}
{{ .Render "summary" }}
{{ end }}
</div>
</div>
</body>
</html>
My summary.html
{{ if eq .Params.past "yes" }}
<div class="tile">
<a href="{{ .Permalink }}">
<span class="roll-img">
<h1>{{ .Title }}</h1>
<h2>{{ .Date.Format "02 Jan 2006" }}</h2>
<h3>
{{ range .Params.guests }}
{{ . }},
{{ end }}
</h3>
</span>
<img src="img/evenements/{{ .Params.img }}.jpg" alt="Test"/>
</a>
</div>
{{ end }}
{{ if eq .Params.past "no" }}
<div class="tile">
<a href="{{ .Permalink }}">
<span class="roll-img">
<h1>{{ .Title }}</h1>
<h2>{{ .Date.Format "02 Jan 2006" }}</h2>
<h3>
{{ range .Params.guests }}
{{ . }},
{{ end }}
</h3>
</span>
<img src="img/evenements/{{ .Params.img }}.jpg" alt="Test"/>
</a>
</div>
{{ end }}
Thanks a lot for helping me !