fixed image display for articles without a featured image
[theme-danix.xyz.git] / layouts / articles / list.html
1 {{ define "blog-list" }}
2 <section id="one">
3 <article>
4 <div class="inner">
5 {{ .Content }}
6 </div>
7 </article>
8 <article>
9 <div class="inner">
10 {{ partial "pagination.html" . }}
11 </div>
12 </article>
13 </section>
14 <section id="two" class="spotlights">
15 <!-- Ranges through content/articles/*.md -->
16 {{ range .Paginator.Pages }}
17 <section>
18 <a class="image" href="{{.Permalink}}">
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 }}
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>
41 <p>{{ .Params.excerpt }}</p>
42 <ul class="actions">
43 <li><a href="{{.Permalink}}" class="button">Read More</a></li>
44 </ul>
45 </div>
46 </div>
47 </section>
48 {{ end }}
49 </section>
50 <section id="three">
51 <div class="inner">
52 {{ partial "pagination.html" . }}
53 </div>
54 </section>
55 {{ end }}