diff --git a/layouts/index.html b/layouts/index.html
index 90bdd02..4c80892 100755
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -2,18 +2,27 @@
{{ .Content }}
- {{/* For Hugo 0.20 this will default to the section with the most number of pages. */}}
+ {{/* Define a section to pull recent posts from. For Hugo 0.20 this will default to the section with the most number of pages. */}}
{{ $mainSections := .Site.Params.mainSections | default (slice "post") }}
- {{/* Create a variable to use the same section twice. */}}
+ {{/* Create a variable with that section to use in multiple places. */}}
{{ $section := where .Site.RegularPages "Section" "in" $mainSections }}
+ {{/* Check to see if the section is defined for ranging through it */}}
{{ if $section }}
+
+ {{/* Derive the section name by creating a string from the initial section definition */}}
+ {{ $section_name := printf "%s" (delimit ($mainSections) " ") }}
+
-
- Recent Articles
-
+ {{/* Use $section_name to get the section title. Use "with" to only show it if it exists */}}
+ {{ with .Site.GetPage "section" $section_name }}
+
+ Recent {{ .Title }}
+
+ {{ end }}
+ {{/* Range through the first three items of the section */}}
{{ range (first 3 $section) }}
{{ partial "summary-with-image.html" . }}
@@ -22,8 +31,10 @@
- More Posts
- {{/* Nest the requirements, "after" then "first" on the outside */}}
+
+ More
+
+ {{/* Now, range through the next four after the initial 3 items. Nest the requirements, "after" then "first" on the outside */}}
{{ range (first 4 (after 3 $section)) }}
{{ end }}
- All Posts
-
-
+ {{/* As above, Use $section_name to get the section title, and URL. Use "with" to only show it if it exists */}}
+ {{ with .Site.GetPage "section" $section_name }}
+ All {{.Title }}
+ {{ end }}
+
+
+
+
{{ end }}
{{ end }}