From 8765dbbedeb154cc92b79c3802b8fbfb25d7be2e Mon Sep 17 00:00:00 2001
From: LucasVadilho <lucas.vadilho@gmail.com>
Date: Thu, 17 Sep 2020 19:06:46 +0000
Subject: [PATCH] Include alt attribute to thumbnail

---
 exampleSite/content/post/markdown-syntax.md |    4 +++-
 exampleSite/content/post/rich-content.md    |    4 +++-
 exampleSite/content/post/emoji-support.md   |    4 +++-
 layouts/index.html                          |    4 ++--
 4 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/exampleSite/content/post/emoji-support.md b/exampleSite/content/post/emoji-support.md
index 0a8510a..8c2cade 100644
--- a/exampleSite/content/post/emoji-support.md
+++ b/exampleSite/content/post/emoji-support.md
@@ -6,7 +6,9 @@
 tags = [
     "emoji",
 ]
-thumbnail = "http://placeimg.com/150/150/any?2"
+[thumbnail]
+	src = "http://placeimg.com/150/150/any?2"
+	alt = "Thumbnail image"
 +++
 
 Emoji can be enabled in a Hugo project in a number of ways. 
diff --git a/exampleSite/content/post/markdown-syntax.md b/exampleSite/content/post/markdown-syntax.md
index 2d4b210..995aa79 100644
--- a/exampleSite/content/post/markdown-syntax.md
+++ b/exampleSite/content/post/markdown-syntax.md
@@ -15,7 +15,9 @@
 ]
 series = ["Themes Guide"]
 aliases = ["migrate-from-jekyl"]
-thumbnail = "http://placeimg.com/150/150/any?1"
+[thumbnail]
+  src = "http://placeimg.com/150/150/any?1"
+  alt = "Thumbnail image"
 +++
 
 This article offers a sample of basic Markdown syntax that can be used in Hugo content files, also it shows whether basic HTML elements are decorated with CSS in a Hugo theme.
diff --git a/exampleSite/content/post/rich-content.md b/exampleSite/content/post/rich-content.md
index ba30e12..f1cc692 100644
--- a/exampleSite/content/post/rich-content.md
+++ b/exampleSite/content/post/rich-content.md
@@ -7,7 +7,9 @@
     "shortcodes",
     "privacy",
 ]
-thumbnail = "http://placeimg.com/150/150/any?3"
+[thumbnail]
+    src = "http://placeimg.com/150/150/any?3"
+    alt = "Thumbnail image"
 +++
 
 Hugo ships with several [Built-in Shortcodes](https://gohugo.io/content-management/shortcodes/#use-hugo-s-built-in-shortcodes) for rich content, along with a [Privacy Config](https://gohugo.io/about/hugo-and-gdpr/) and a set of Simple Shortcodes that enable static and no-JS versions of various social media embeds.
diff --git a/layouts/index.html b/layouts/index.html
index dbd9081..e01fc8e 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -26,9 +26,9 @@
                     </div>
                 </div>
             </div>
-            {{ if isset .Params "thumbnail" }}
+            {{ with .Params.thumbnail }}
             <div class="thumbnail">
-                <img src="{{ .Params.thumbnail | absURL }}" loading="lazy">
+                <img src="{{ .src | absURL }}" alt="{{ .alt | default "" }}" loading="lazy">
             </div>
             {{ end }}
         </div>

--
Gitblit v1.10.0