summaryrefslogtreecommitdiff
path: root/layouts/_default/taxonomy.html
blob: 24606ff89da1f1eca1012c25257fd3fbbd8899ea (plain)
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
{{ define "main" }}
<article class="taxonomy">
  {{ partial "header.html" . }}
  {{ partial "components/postnav.html" . }}

  <!-- Display Tags -->
  {{ if eq .Type "tags" }}
  <section class="taxonomy-tags">
    {{ range sort .Site.Taxonomies.tags "Count" "desc" }}
    <a href="{{ .Page.RelPermalink }}" class="taxonomy-tags-item">
        <span class="tag-name">#{{ .Page.LinkTitle }}</span>
        <span class="tag-count">{{ .Count }}</span>
    </a>
    {{ end }}
  </section>
  {{ end }}

  <!-- Display Categories -->
  {{ if eq .Type "categories" }}
  {{ partial "components/welcome.html" . }}
  <section class="taxonomy-categories">
      {{ range sort .Site.Taxonomies.categories ".Count" "desc" }}
        <div class="taxonomy-categories-item">
            <h3 class="category-title">
                <a href="{{ .Page.RelPermalink }}">
                    {{ with .Page.Params.icon }}<span>{{ . }}</span>{{ end }} {{ .Page.LinkTitle }}
                </a>
            </h3>
            <p>{{ .Page.Params.description }}</p>
            <ul class="category-articles">
            {{ range first 6 .Pages }}
                <li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
            {{ end }}
            </ul>
            {{ if gt .Count 6 }}
            <a class="category-link"
                href="{{ .Page.RelPermalink }}"
            >阅读所有 {{ .Count }} 篇文章</a>
            {{ end }}
        </div>
    {{ end }}
  </section>
  {{ end }}

</article>
{{ partial "footer.html" . }}
{{ end }}