feat: seperate content year wise
Closed this issue · 2 comments
kranurag78 commented
Hey there, Thanks for the nice theme.
It will be nice to seperate content year wise on the page list.
Here's how I'm implementing it locally
list.html
{{ define "main" }}
<main class="container mx-auto">
{{ if isset .Data "Term" }}
<h2 class="text-4xl mt-8 mb-8">{{ .Data.Singular | title }} - "{{ .Data.Term }}"</h2>
{{ else }}
<h2 class="text-4xl mt-8 mb-8">{{ .Title }}</h2>
{{ end }}
<div class="mt-8">
{{ range .Data.Pages.GroupByDate "2006" }}
<h3 class="text-4xl"><a href="#{{ .Key }}">{{ .Key }}</a></h3>
{{ range .Pages }}
{{ partial "item.html" . }}
{{ end }}
{{ end }}
</div>
</main>
{{ end }}
Let me know if there's feedback w.r.t the changes. I can send a PR if you approve.
Happy Vacation 🌴
mivinci commented
Awesome 🥳
Thanks for your advice but I think it will be nicer if your PR be like:
{{ define "main" }}
<main class="container mx-auto">
{{ if isset .Data "Term" }}
<h2 class="text-4xl mt-8 mb-8">{{ .Data.Singular | title }} - "{{ .Data.Term }}"</h2>
{{ else }}
<h2 class="text-4xl mt-8 mb-8">{{ .Title }}</h2>
{{ end }}
<div class="mt-8">
{{ range .Data.Pages.GroupByDate "2006" }}
<h3 class="text-3xl font-medium mb-2 mt-4">
<a href="#{{ .Key }}">{{ .Key }}</a>
</h3>
{{ range .Pages }}
{{ partial "item.html" . }}
{{ end }}
{{ end }}
</div>
</main>
{{ end }}
Happy Hacking 🌴
kranurag78 commented
completed with #50