1
Fork 0

Store number of links in config

This commit is contained in:
Jake Howard 2017-05-07 18:43:04 +01:00
parent 2b10f74461
commit 1dcbe54995
3 changed files with 6 additions and 4 deletions

View file

@ -6,6 +6,8 @@ params:
author: TheOrangeOne author: TheOrangeOne
author_name: Jake Howard author_name: Jake Howard
summary_length: 100 summary_length: 100
nav_items: 5
index_items: 6
staticDir: "static/build" staticDir: "static/build"

View file

@ -43,7 +43,7 @@
<div class="box special"> <div class="box special">
<h2>Projects</h2> <h2>Projects</h2>
<div class="row"> <div class="row">
{{ range first 6 (where .Data.Pages.ByDate "Section" "projects") }} {{ range first .Site.Params.index_items (where .Data.Pages.ByDate "Section" "projects") }}
{{ partial "box.html" . }} {{ partial "box.html" . }}
{{ end }} {{ end }}
</div> </div>
@ -53,7 +53,7 @@
<div class="box special"> <div class="box special">
<h2>Recent Posts</h2> <h2>Recent Posts</h2>
<div class="row"> <div class="row">
{{ range first 6 (where .Data.Pages.ByDate "Section" "!=" "") }} {{ range first .Site.Params.index_items (where .Data.Pages.ByDate "Section" "!=" "") }}
{{ partial "box.html" . }} {{ partial "box.html" . }}
{{ end }} {{ end }}
</div> </div>

View file

@ -7,10 +7,10 @@
<a href="{{ .Permalink }}">{{ .LinkTitle }}</a> <a href="{{ .Permalink }}">{{ .LinkTitle }}</a>
{{ if .Pages }} {{ if .Pages }}
<ul> <ul>
{{ range first 4 .Pages.ByDate }} {{ range first .Site.Params.nav_items .Pages.ByDate }}
<li><a href="{{ .Permalink }}">{{ .LinkTitle }}</a></li> <li><a href="{{ .Permalink }}">{{ .LinkTitle }}</a></li>
{{ end }} {{ end }}
{{ if ge (len .Pages) 4 }} {{ if ge (len .Pages) .Site.Params.nav_items }}
<li><a href="{{ .Permalink }}"><i>See more</i></a></li> <li><a href="{{ .Permalink }}"><i>See more</i></a></li>
{{ end }} {{ end }}
</ul> </ul>