Browse Source

only show labels if posts exist

simplify
Alexander Avery 2 months ago
parent
commit
86a069e5ef
  1. 38
      layouts/_default/list.html

38
layouts/_default/list.html

@ -12,30 +12,30 @@
{{- end }} {{- end }}
</main> </main>
<section>
<h2>Latest Posts:</h2>
{{ with $pages.Limit 4 }} {{ with $pages.Limit 4 }}
<section class="article-list"> <section>
{{ range . }} <h2>Latest Posts:</h2>
{{ partial "article.html" . }} <section class="article-list">
{{ end }} {{ range . }}
</section> {{ partial "article.html" . }}
{{ end }}
</section>
</section>
{{ end }} {{ end }}
</section>
<section>
<h2>All Posts:</h2>
{{ with $pages }} {{ with $pages }}
{{ range .GroupByDate "2006" }} <section>
<p>{{ .Key }}</p> <h2>All Posts:</h2>
<ul> {{ range .GroupByDate "2006" }}
{{ range .Pages -}} <p>{{ .Key }}</p>
<li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li> <ul>
{{ end -}} {{ range .Pages -}}
</ul> <li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
{{ end }} {{ end -}}
</ul>
{{ end }}
</section>
{{ end }} {{ end }}
</section>
{{ end }} {{ end }}

Loading…
Cancel
Save