website/layouts/partials/simple_posts_list.html

32 lines
1.0 KiB
HTML

<h2>
{{ $title := .Title }}
{{ $section := .Section | humanize }}
{{ if and (ne $section $title) (ne $section "Tags") (ne $title (printf "%ss" $section)) }}
{{ $section }}:
{{ end }}
{{ if and (eq $section "Tags") (ne $section $title) }}Tag: #{{ end }}{{ $title }}
</h2>
<ul class="list">
{{ if and (eq $section "Tags") (eq $section $title) }}
{{/* if we're in the Tags section, sort alphabetically and don't show the date */}}
{{ range (sort .Pages "Title") }}
<li>
<a href="{{ .Permalink }}">#{{ .Title }}</a>
</li>
{{ end }}
{{ else }}
{{ range .Pages }}
<li>
<div>
<span class="date">
{{ .Date.Format "2006-01-02" }}
</span>
<span>
<a href="{{ .Permalink }}">{{ .Title }}</a>
</span>
</div>
</li>
{{ end }}
{{ end }}
</ul>