diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index d61ed0507..0b5e1648f 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -28,3 +28,4 @@ enableRobotsTXT = true
# choose a background color from any on this page: http://tachyons.io/docs/themes/skins/ and preface it with "bg-"
background_color_class = "bg-black"
featured_image = "/images/gohugo-default-sample-hero-image.jpg"
+ recent_posts_number = 2
diff --git a/layouts/index.html b/layouts/index.html
index dca45d496..3480c04f5 100755
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -20,20 +20,22 @@
{{ end }}
+ {{ $n_posts := $.Param "recent_posts_number" | default 3 }}
+
- {{/* Range through the first three items of the section */}}
- {{ range (first 3 $section) }}
+ {{/* Range through the first $n_posts items of the section */}}
+ {{ range (first $n_posts $section) }}
{{ partial "summary-with-image.html" . }}
{{ end }}
- {{ if ge $section_count 4 }}
+ {{ if ge $section_count (add $n_posts 1) }}
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)) }}
+ {{/* Now, range through the next four after the initial $n_posts items. Nest the requirements, "after" then "first" on the outside */}}
+ {{ range (first 4 (after $n_posts $section)) }}