fixed image display for articles without a featured image
[theme-danix.xyz.git] / layouts / articles / list.html
CommitLineData
02fcbbf7 1{{ define "blog-list" }}
2<section id="one">
3 <article>
4 <div class="inner">
5 {{ .Content }}
6 </div>
7 </article>
c2ea6701 8 <article>
9 <div class="inner">
10 {{ partial "pagination.html" . }}
11 </div>
12 </article>
02fcbbf7 13</section>
14<section id="two" class="spotlights">
26ee5f4d 15 <!-- Ranges through content/articles/*.md -->
c2ea6701 16 {{ range .Paginator.Pages }}
02fcbbf7 17 <section>
18 <a class="image" href="{{.Permalink}}">
8158405e 19 {{ if isset .Params "featured_image" }}
20 <img src="{{ .Params.featured_image | absURL}}" alt="{{.Title}}">
21 {{ else }}
22 {{ $default_image := resources.Get "img/default_article.jpg" }}
23 <img src="{{ $default_image.Permalink }}" alt="{{.Title}}">
24 {{ end }}
02fcbbf7 25 </a>
26 <div class="content">
27 <div class="inner">
28 <header class="major">
29 <h3>
30 {{ if gt (len .Title) 40 }}
31 {{ $first50 := ( substr .Title 0 40 ) }}
32 {{ $lastChars := ( substr .Title 40 ) }}
33 {{ $newLine := "<br>" }}
34 {{ $newTitle := ( printf "%s" $lastChars | printf "%s%s" $newLine | printf "%s%s" $first50 ) }}
35 {{ $newTitle | safeHTML }}
36 {{ else }}
37 {{ .Title }}
38 {{ end }}
39 </h3>
40 </header>
c2ea6701 41 <p>{{ .Params.excerpt }}</p>
02fcbbf7 42 <ul class="actions">
43 <li><a href="{{.Permalink}}" class="button">Read More</a></li>
44 </ul>
45 </div>
d862564b 46 </div>
02fcbbf7 47 </section>
e28a215c 48 {{ end }}
02fcbbf7 49</section>
c2ea6701 50<section id="three">
51 <div class="inner">
52 {{ partial "pagination.html" . }}
53 </div>
54</section>
e28a215c 55{{ end }}