From be94b5fd052b910d0b3704bea22d26214136f060 Mon Sep 17 00:00:00 2001
From: Bobby <bobbywlindsey@users.noreply.github.com>
Date: Mon, 27 Jan 2020 18:46:37 +0000
Subject: [PATCH] Add an optional featured image (#252)

---
 layouts/posts/single.html                    |    4 ++++
 exampleSite/content/posts/hugoisforlovers.md |    1 +
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/exampleSite/content/posts/hugoisforlovers.md b/exampleSite/content/posts/hugoisforlovers.md
index ecb53ad..f6a051c 100644
--- a/exampleSite/content/posts/hugoisforlovers.md
+++ b/exampleSite/content/posts/hugoisforlovers.md
@@ -12,6 +12,7 @@
     "golang",
 ]
 series = ["Getting Started", "Hugo"]
+featured_image = "https://imgs.xkcd.com/comics/angular_momentum.jpg"
 +++
 
 ## Step 1. Install Hugo
diff --git a/layouts/posts/single.html b/layouts/posts/single.html
index eedb778..1e7d064 100644
--- a/layouts/posts/single.html
+++ b/layouts/posts/single.html
@@ -27,9 +27,13 @@
       </header>
 
       <div>
+        {{ if .Params.featured_image }}
+          <img src='{{ .Params.featured_image }}' alt="Featured image"/>
+        {{ end }}
         {{ .Content }}
       </div>
 
+
       <footer>
         {{ partial "posts/series.html" . }}
         {{ partial "posts/disqus.html" . }}

--
Gitblit v1.10.0