blob: 35d85a9f3934be5f87e42d046ee2b2f4da5cc313 (
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
|
<ul class="stats">
{{ if isset .Params "categories" }}
{{ $categoryCount := (len .Params.categories) }}
<!--
Set the title before displaying the categories associated with this post.
The title will use the variables from the Categories menu set in the Config.
If the Categories menu was not set then use the default values instead.
-->
{{ if ge $categoryCount 1 }}
<li>
{{ $categoryMenu := (where .Site.Menus.main "Name" "Categories") }}
{{ if ne (len $categoryMenu) 0 }}
{{ $categoryMenu := index $categoryMenu 0 }}
{{ $.Scratch.Set "categoryUrl" $categoryMenu.URL }}
{{ with $categoryMenu.Identifier }}
<i class="{{ . }}"> </i>
{{ end }}
{{ if gt $categoryCount 1 }}
{{ $categoryMenu.Name }}
{{ else }}
{{ $categoryMenu.Name | singularize }}
{{ end }}
{{ else }}
{{ $.Scratch.Set "categoryUrl" "/categories/" }}
{{ if gt $categoryCount 1 }}
Categories
{{ else }}
Category
{{ end }}
{{ end }}
</li>
{{ end }}
{{ end }}
<!-- Display the categories associated with this post -->
{{ range .Params.categories }}
<li><a href='{{ add ($.Scratch.Get "categoryUrl") . | urlize }}'>{{ . }}</a></li>
{{ end }}
</ul>
|