blob: f7bd7b5a0a2fa61e15366da354915fa5909d5505 (
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
|
<article class="post-item">
{{$grid_class := ""}}
{{if (not (isset .Params "description")) | and (not (isset .Params "image")) | and (not (isset .Params "tags"))}}
{{$grid_class = "post-item-grid--only-title"}}
{{else if (not (isset .Params "description")) | and (not (isset .Params "image"))}}
{{$grid_class = "post-item-grid--title-with-tag"}}
{{else if (not (isset .Params "tags") | and (not (isset .Params "image")))}}
{{$grid_class = "post-item-grid--noimage-nopad"}}
{{else if not (isset .Params "description")}}
{{$grid_class = "post-item-grid--nodesc"}}
{{else if not (isset .Params "image")}}
{{$grid_class = "post-item-grid--noimage"}}
{{else if not (isset .Params "tags")}}
{{$grid_class = "post-item-grid--nopad"}}
{{end}}
<div class="post-item-grid {{$grid_class}}">
<a class="post-item-grid__title post-item__link" href="{{.Permalink}}">
<h2 class="post-item__title">{{.Title}}</h2>
<time class="post-item__date" datetime="{{.Date.Format "2006-01-02"}}">{{.Date.Format "2006-01-02"}}</time>
</a>
{{if isset .Params "description"}}
<a class="post-item-grid__description post-item__link" href="{{.Permalink}}">
<div class="post-item__description">{{.Description}}</div>
</a>
{{end}}
{{if isset .Params "image"}}
<a class="post-item-grid__image post-item__image" href="{{.Permalink}}">
<img src="{{printf "%s%s" .File.Dir .Params.image}}" alt="{{.Title}}" />
</a>
{{end}}
{{if isset .Params "tags"}}
<a href="/tags/{{index .Params.tags 0 | urlize}}" class="post-item__tag">
{{index .Params.tags 0}}
</a>
{{end}}
</div>
</article>
|