From a9c96151e0593be2c2984ee04d4cbf3a9ded9dae Mon Sep 17 00:00:00 2001
From: Alexander Eble <35292572+alexanderdavide@users.noreply.github.com>
Date: Sun, 20 Jun 2021 19:22:56 +0000
Subject: [PATCH] Add Option for Main Section Heading (#216)

---
 exampleSite/content/arabic/_index.md  |    3 ++-
 layouts/index.html                    |    8 ++++++++
 exampleSite/content/english/_index.md |    3 ++-
 README.md                             |    3 +++
 4 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 2638ac0..a2d7da7 100644
--- a/README.md
+++ b/README.md
@@ -513,6 +513,9 @@
   mainSections = ["post", "docs"]
 ```
 
+### _index.md and post section header
+You can place custom content, by creating `_index.md` markdown file within the content directory. An example can be found [here](https://github.com/lxndrblz/anatole/blob/exampleSite/content/english/_index.md). Uncomment the section as needed. This file `_index.md` also has a parameter called `mainSectionsTitle`, which lets you specify a header for the posts on the main page. This header will be styled and placed always after the content of the `_index.md` it self.  
+
 ### Robots.txt
 
 If you want Hugo to generate a robots.txt, you will have to set the `enableRobotsTXT` in the `config.toml` to `true`. By default, a robots.txt, which allows search engine crawlers to access to any page, will be generated. It will look like this:
diff --git a/exampleSite/content/arabic/_index.md b/exampleSite/content/arabic/_index.md
index 3e127b3..daa8952 100644
--- a/exampleSite/content/arabic/_index.md
+++ b/exampleSite/content/arabic/_index.md
@@ -3,7 +3,7 @@
 +++
 
 <!--
-This file is left intentionally empty by default to be backward compatible with initial theme setup.
+This file is left intentionally empty by default to be backwards compatible with the 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:
@@ -21,4 +21,5 @@
 Don't forget to check the README.md file!
 ```
 
+Remember that you can also specify a section header for the posts below by configuring the `mainSectionsTitle` parameter in the front matter of this file.
 -->
diff --git a/exampleSite/content/english/_index.md b/exampleSite/content/english/_index.md
index 3e127b3..daa8952 100644
--- a/exampleSite/content/english/_index.md
+++ b/exampleSite/content/english/_index.md
@@ -3,7 +3,7 @@
 +++
 
 <!--
-This file is left intentionally empty by default to be backward compatible with initial theme setup.
+This file is left intentionally empty by default to be backwards compatible with the 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:
@@ -21,4 +21,5 @@
 Don't forget to check the README.md file!
 ```
 
+Remember that you can also specify a section header for the posts below by configuring the `mainSectionsTitle` parameter in the front matter of this file.
 -->
diff --git a/layouts/index.html b/layouts/index.html
index 1e2aaa0..a09d3bc 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -13,6 +13,14 @@
         -->
     </div>
 
+    {{ if .Params.mainSectionsTitle }}
+    <div class="post {{ with .Site.Params.doNotLoadAnimations }} . {{ else }} animated fadeInDown {{ end }}">
+        <div class="post-title post-content">
+            <h2>{{ .Params.mainSectionsTitle }}</h2>
+        </div>
+    </div>
+    {{ end }}
+
     {{ $paginator := .Paginate (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) }}
     {{ range $paginator.Pages }}
 

--
Gitblit v1.10.0