From 36ee0f5b8d40acbb670ec6a3459ea0759b2b9ef5 Mon Sep 17 00:00:00 2001
From: Karol Kania <999044+khanyooh@users.noreply.github.com>
Date: Sat, 05 Dec 2020 01:20:40 +0000
Subject: [PATCH] Make it possible to add (optional) content to Home page

---
 exampleSite/content/_index.md |   21 +++++++++++++++++++++
 layouts/index.html            |   12 ++++++++++++
 2 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/exampleSite/content/_index.md b/exampleSite/content/_index.md
index ed6494b..3e127b3 100644
--- a/exampleSite/content/_index.md
+++ b/exampleSite/content/_index.md
@@ -1,3 +1,24 @@
 +++
 author = "Hugo Authors"
 +++
+
+<!--
+This file is left intentionally empty by default to be backward compatible with initial theme setup.
+
+Although the theme has advanced a little bit and it now allows to specify the content on the main page (even if the list of posts/articles is not intended).
+This can be:
+- with the list of posts/articles (default: `mainSections = ["post"]) or
+- without the list of posts/articles (by setting `mainSections = [""]`)
+
+Markdown supported, ie:
+
+```
+# Welcome
+
+- Hugo :rocket:
+- Hugo theme :rocket:
+
+Don't forget to check the README.md file!
+```
+
+-->
diff --git a/layouts/index.html b/layouts/index.html
index ee00591..7b91878 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -1,6 +1,18 @@
 {{ define "main" }}
+
+    <div class="post {{ with .Site.Params.doNotLoadAnimations }} . {{ else }} animated fadeInDown {{ end }}">
+        <!-- (Optional) Home
+            -- on top of `mainSections` content (aka posts) ;
+            -- as declared in content/_index.md
+
+            One can set `mainSections = [""]` and have the content/_index.md specified here
+        -->
+        {{ .Content }}
+    </div>
+
     {{ $paginator := .Paginate (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) }}
     {{ range $paginator.Pages }}
+
         <div class="post {{ with .Site.Params.doNotLoadAnimations }} . {{ else }} animated fadeInDown {{ end }}">
             <div class="post-title">
                 <h3><a href="{{ .RelPermalink }}">{{ .Title }}</a>

--
Gitblit v1.10.0