mivinci / hugo-theme-minima

A clean and minimal Hugo theme.
https://mivinci.github.io/hugo-theme-minima
MIT License
130 stars 37 forks source link

feat: seperate content year wise #49

Closed kranurag78 closed 1 year ago

kranurag78 commented 1 year ago

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` ```html {{ define "main" }}
{{ if isset .Data "Term" }}

{{ .Data.Singular | title }} - "{{ .Data.Term }}"

{{ else }}

{{ .Title }}

{{ end }}
{{ range .Data.Pages.GroupByDate "2006" }}

{{ .Key }}

{{ range .Pages }} {{ partial "item.html" . }} {{ end }} {{ end }}
{{ 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 1 year ago

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 1 year ago

completed with https://github.com/mivinci/hugo-theme-minima/pull/50