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: Year wise formatting of posts #50

Closed kranurag78 closed 1 year ago

kranurag78 commented 1 year ago

Here's how it looks. image

🥳

kranurag78 commented 1 year ago

I think <hr> is adding a very clear boundary between years but if you want I can remove that. Without <hr> the list is looking Little mixed up to me.

mivinci commented 1 year ago

I will check out which looks better later, or probably we can make it an option in the config file.

kranurag78 commented 1 year ago

I will check out which looks better later, or probably we can make it an option in the config file.

Please take your time.

I think we can go with either of one, I think it's not someting for which a seperate config is required.

Here's how it looks without <hr> tag. IMHO, I think the titles and year are looking little mixed up. But, I'm happy with any of the two. I will wait for your decision and then I will squash the commits after implementing the suggestion.

image

mivinci commented 1 year ago

I'll still go without <hr> tag because it looks cleaner, but I added more spacing between the year (with font-bold) and titles to make them seem less mixed up.

image

Here's the update

{{ 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-bold mb-4 mt-8">
        <a href="#{{ .Key }}">{{ .Key }}</a>
      </h3>
      {{ range .Pages }}
      {{ partial "item.html" . }}
      {{ end }}
    {{ end }}
  </div>
</main>
{{ end }}
kranurag78 commented 1 year ago

@mivinci I've updated the PR with the changes that you requested and squashed the commits. I really appreciate the quick response from your side. I've also opened a discussion in the discussion tab and will really appreciate if you can help me there subject to your time availability.