theNewDynamic / gohugo-theme-ananke

Ananke: A theme for Hugo Sites
https://gohugo-ananke-theme-demo.netlify.com/
MIT License
1.09k stars 1.12k forks source link

Unnecessary vertical space on index page if there is no content #663

Open mikaelstaldal opened 8 months ago

mikaelstaldal commented 8 months ago

In layouts/index.html, there is a article element for content, which creates unnecessary (and IMHO annoying) vertical space if there is no content to display:

    <article class="cf ph3 ph5-l pv3 pv4-l f4 tc-l center measure-wide lh-copy {{ $.Param "text_color" | default "mid-gray" }}">
      {{ .Content }}
    </article>

https://github.com/theNewDynamic/gohugo-theme-ananke/blob/master/layouts/index.html#L2

I suggest that this article element is only included if there is content to display. Something like this:

  {{ if .Content }}
    <article class="cf ph3 ph5-l pv3 pv4-l f4 tc-l center measure-wide lh-copy {{ $.Param "text_color" | default "mid-gray" }}">
      {{ .Content }}
    </article>
  {{ end }}