Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/funkydan2/hugo-kiera.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Saunders <daniel.saunders@gmail.com>2020-02-23 08:08:21 +0300
committerDaniel Saunders <daniel.saunders@gmail.com>2020-02-23 08:08:21 +0300
commit4db667624a43640c3d1664daeb1bb80f837414fc (patch)
tree21aa57ee86df5e9ac4c3ced98fa5485d6e98146b
parenteb3045b049f4ce8c756d64032d6104a35756f228 (diff)
Assign number of posts on index page.20200223
-rw-r--r--exampleSite/config.toml1
-rw-r--r--layouts/index.html6
2 files changed, 6 insertions, 1 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 3dfba07..591f2e0 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -32,6 +32,7 @@ pygmentsCodeFences = true
#favicon = ""
#utterancesRepo = "https://github.com/MyRepo"
#utterancesIssueTerm = "pathname"
+ #homepageLength = 10
# uncomment to enable the Tags link on the main toolbar
# [[menu.main]]
diff --git a/layouts/index.html b/layouts/index.html
index 64c4c37..71d99ec 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -2,7 +2,11 @@
<section id="home">
<ul>
- {{ range $index, $page := first 10 (where site.RegularPages "Section" "in" .Site.Params.mainSections) }}
+ {{ $hp_length := 10 }}
+ {{ if isset .Site.Params "homepagelength" }}
+ {{ $hp_length = .Site.Params.homepageLength }}
+ {{ end }}
+ {{ range $index, $page := first $hp_length (where site.RegularPages "Section" "in" .Site.Params.mainSections) }}
<li {{if eq $index 0}}class="first" {{end}}>
<h1><a href="{{ .Permalink }}" title="{{ .Title }}">{{ .Title }}</a></h1>
{{ partial "aside" . }}