Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/funkydan2/hugo-kiera.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOvidiu-Florin BOGDAN <ovidiu.b13@gmail.com>2019-12-31 15:05:47 +0300
committerOvidiu-Florin BOGDAN <ovidiu.b13@gmail.com>2019-12-31 15:05:47 +0300
commit75efdb1e8d2553e695fe15dab612143a98cc0ce5 (patch)
treed600e4364ca4c5a76939f597185d6e88db852b98 /layouts
parenta2f861d9d7c88ac54221aa443e1252c5332543ce (diff)
Add featured image logic
Diffstat (limited to 'layouts')
-rw-r--r--layouts/index.html27
-rw-r--r--layouts/partials/article.html3
-rw-r--r--layouts/partials/featured_image.html7
3 files changed, 23 insertions, 14 deletions
diff --git a/layouts/index.html b/layouts/index.html
index e62e6bc..64c4c37 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -1,18 +1,19 @@
{{ define "main" }}
<section id="home">
- <ul>
- {{ range $index, $page := first 10 (where site.RegularPages "Section" "in" .Site.Params.mainSections) }}
- <li {{if eq $index 0}}class="first"{{end}}>
- <h1><a href="{{ .Permalink }}" title="{{ .Title }}">{{ .Title }}</a></h1>
- {{ partial "aside" . }}
- <p>{{ .Summary }}</p>
- {{ if .Truncated }}
- <a href="{{ .RelPermalink }}">{{ T "readMore" }}</a>
- {{ end }}
- </li>
- {{ end }}
- </ul>
- </section>
+ <ul>
+ {{ range $index, $page := first 10 (where site.RegularPages "Section" "in" .Site.Params.mainSections) }}
+ <li {{if eq $index 0}}class="first" {{end}}>
+ <h1><a href="{{ .Permalink }}" title="{{ .Title }}">{{ .Title }}</a></h1>
+ {{ partial "aside" . }}
+ {{ partial "featured_image" .}}
+ <p>{{ .Summary }}</p>
+ {{ if .Truncated }}
+ <a href="{{ .RelPermalink }}">{{ T "readMore" }}</a>
+ {{ end }}
+ </li>
+ {{ end }}
+ </ul>
+</section>
{{ end }}
diff --git a/layouts/partials/article.html b/layouts/partials/article.html
index 317a889..6644012 100644
--- a/layouts/partials/article.html
+++ b/layouts/partials/article.html
@@ -3,7 +3,8 @@
<h1>{{ .Title }}</h1>
{{ if or (not (isset .Params "meta")) (eq .Params "meta" true) }}
- {{ partial "aside" . }}
+ {{ partial "aside" . }}
+ {{ partial "featured_image" .}}
{{ end }}
{{.Content}}
diff --git a/layouts/partials/featured_image.html b/layouts/partials/featured_image.html
new file mode 100644
index 0000000..8165e0d
--- /dev/null
+++ b/layouts/partials/featured_image.html
@@ -0,0 +1,7 @@
+{{if isset .Params "featured_image" }}
+<div class="featured_image">
+ <a href="{{ .Permalink }}" title="{{ .Title }}">
+ <img src="{{ index .Params "featured_image" }}">
+ </a>
+</div>
+{{ end }}