initial setup of related content inside single articles. Needs working.
[theme-danix.xyz.git] / layouts / partials / funcs / related.html
1 {{ $related := .Site.RegularPages.Related . | first 5 }}
2 {{ with $related }}
3 <h3>You might also be interested in:</h3>
4 <ul>
5 {{ range . }}
6 <li>
7 <a class="image" href="{{.Permalink}}">
8 {{ if isset .Params "featured_image" }}
9 <img src="{{ .Params.featured_image | absURL}}" alt="{{.Title}}" width="200">
10 {{ else }}
11 {{ $default_image := resources.Get "img/default_article.jpg" }}
12 <img src="{{ $default_image.Permalink }}" alt="{{.Title}}" width="200">
13 {{ end }}
14 {{ .Title }}
15 </a>
16 </li>
17 {{ end }}
18 </ul>
19 {{ else }}
20 <h3>Check out these awesome articles:</h3>
21 <ul>
22 {{ range first 5 ( where site.RegularPages "Type" "in" site.Params.mainSections ) }}
23 <li>
24 <a class="image" href="{{.Permalink}}">
25 {{ if isset .Params "featured_image" }}
26 <img src="{{ .Params.featured_image | absURL}}" alt="{{.Title}}" width="200">
27 {{ else }}
28 {{ $default_image := resources.Get "img/default_article.jpg" }}
29 <img src="{{ $default_image.Permalink }}" alt="{{.Title}}" width="200">
30 {{ end }}
31 {{ .Title }}
32 </a>
33 </li>
34 {{ end }}
35 </ul>
36 {{ end }}