fixed image display for articles without a featured image
[theme-danix.xyz.git] / layouts / articles / list.html
index 6c13939..0de0f5a 100644 (file)
        {{ range .Paginator.Pages }}
        <section>
                <a class="image" href="{{.Permalink}}">
-                       <img src="{{ .Params.featured_image | absURL}}" alt=".Title">
+               {{ if isset .Params "featured_image" }}
+                       <img src="{{ .Params.featured_image | absURL}}" alt="{{.Title}}">
+               {{ else }}
+                       {{ $default_image := resources.Get "img/default_article.jpg" }} 
+                       <img src="{{ $default_image.Permalink }}" alt="{{.Title}}">
+               {{ end }}
                </a>
                <div class="content">
                        <div class="inner">