website-theme/layouts/blog/list.html
2023-09-26 15:54:37 -04:00

46 lines
1.4 KiB
HTML

{{ define "main"}}
{{ partial "header.html" . }}
<main>
{{ partial "search.html" . }}
{{ partial "tags/all.html" . }}
<br/>
{{ $posts := where site.RegularPages "Type" "blog" }}
{{ $postCount := len $posts }}
{{ range last 1 $posts }}
{{ $tags := .Site.Taxonomies.tags }}
<div class='bloglist-teaser block-center'>
Hello! This page contains <strong>{{ $postCount | lang.NumFmt 0 }} posts</strong>
written in the past <strong>{{ div (sub now.Unix .Date.Unix) 31536000 }} years</strong>
spanning
{{ len $tags }} topics within the dropdown above.
</div>
{{ end }}
<!-- contents -->
<div class="bloglist">
{{ $listPageDateFormat := .Site.Params.listPageDateFormat | default "January, 2006"}}
{{ range $index, $value := .Pages.GroupByDate $listPageDateFormat }}
{{ if (ne $index 0) }}
<hr class="separator">
{{ end }}
<p class="bloglist-date">{{ .Key }}</p>
{{ range .Pages }}
<div class="bloglist-item">
<p><a href="{{ .Permalink }}">{{ .Title }}</a></p>
<p class="bloglist-item-tag">
{{ range .Params.tags }}
{{ $name := . }}
{{ with $.Site.GetPage (printf "/tags/%s" (. | urlize)) }}
<span><a href="{{ .Permalink }}">#{{ $name }}</a> </span>
{{ end }}
{{ end }}
</p>
</div>
{{ end }}
{{ end }}
</div>
</main>
{{ end }}