aboutsummaryrefslogtreecommitdiffstats
path: root/layouts/archives/single.html
blob: dc089ff9bf0de475b353419b6351eb579fd45cf7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{{ define "main" }}
<header>
<a href="{{ "" | relURL }}" class="title">
  <p class="site-title">{{ .Site.Title }}</p>
</a>
<nav>{{- partial "nav.html" . -}}</nav>
</header>


<content>
  {{ if .Data.Singular }}
  <h3 style="margin-bottom:0">Filtering for "{{ .Title }}"</h3>
  <small>
    <a href="{{ "blog" | relURL }}">Remove filter</a>
  </small>
  {{ end }}

  {{ $allPosts := where .Site.RegularPages "Type" "eq" "posts" }}
  {{ $excludePosts := where $allPosts "Params.categories" "intersect" (slice "1") }}
  {{ $postPages := ($allPosts | complement $excludePosts) }}

  {{ if .Site.Params.showPostCount }}
  <p id="post-count">There {{ if le (len $postPages) 1 }} is {{ len $postPages }} piece. {{ else }} are {{ len $postPages }} pieces. {{ end }}</p>
  {{ end }}

  <ul class="blog-posts">
    {{ $currentYear := 0 }}
    {{ range $postPages }}
      {{ if .Site.Params.groupByYear }}
        {{ $year := .Date.Year }}
        {{ if ne $year $currentYear }}
          <h3>{{ $year }}</h3>
          {{ $currentYear = $year }}
        {{ end }}
      {{ end }}
      <li>
        <span class="{{ if .Site.Params.groupByYear }} grouped {{ else }} ungrouped {{ end }}">
          <i>
            <time datetime='{{ .Date.Format "2006-01-02" }}' pubdate>
              {{ if .Site.Params.groupByYear }}
                {{ .Date.Format (default "2006-01-02" .Site.Params.dateFormat) }}
              {{ else }}
                {{ .Date.Format (default "02 Jan, 2006" .Site.Params.dateFormat) }}
              {{ end }}
            </time>
          </i>
        </span>
        <a style="border: none;" href="{{ .Permalink }}">{{ .Title }}</a>
      </li>
    {{ else }}
      <li>No posts yet</li>
    {{ end }}
  </ul>

  {{ if .Data.Singular }}
  {{ else }}
  <small>
    <div>
      {{ range .Site.Taxonomies.tags }}
        <a href="{{ .Page.Permalink }}">#{{ .Page.Title }}</a>&nbsp;
      {{ end }}
    </div>
  </small>
  {{ end }}
</content>
{{ end }}