diff options
author | Curtis Timson <curt@live.co.uk> | 2018-06-04 20:47:39 +0300 |
---|---|---|
committer | Curtis Timson <curt@live.co.uk> | 2018-06-04 20:47:39 +0300 |
commit | 7227a66c0427213ce61e0cc59806f4a166f01347 (patch) | |
tree | f6834b3e4080234bba6ae16a9a4a8ab105cdb949 /layouts | |
parent | 63a2c28f5d7dbd4e309291e7d30e08d2fc490731 (diff) |
Add default values for post settings
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/index.html | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/layouts/index.html b/layouts/index.html index 237d062..b45fb1c 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,21 +1,24 @@ {{ partial "htmlhead" . }} <body lang='{{ .Site.Language.Lang | default "en-us" }}' class="is-loading"> - {{ $posts := where .Data.Pages "Type" .Site.Params.Posts.foldername }} - {{ $firstPost := first 1 $posts }} + {{ $postsFoldername := .Site.Params.Posts.foldername | default "post" }} + {{ $postsPageSize := .Site.Params.Posts.pagesize | default 6 }} + {{ $postsFeaturedPost := .Site.Params.Posts.featuredpost | default "true" }} + {{ $posts := where .Data.Pages "Type" $postsFoldername }} + {{ $firstPost := first 1 $posts }} - {{ if and (eq .Site.Params.Posts.featuredpost "true") (gt (len $posts) 1) }} + {{ if and (eq $postsFeaturedPost "true") (gt (len $posts) 1) }} {{ .Scratch.Set "postsForPaging" (after 1 $posts) }} {{ else }} {{ .Scratch.Set "postsForPaging" $posts }} {{ end }} {{ $postsForPaging := .Scratch.Get "postsForPaging" }} - {{ $postsPaging := .Paginate $postsForPaging .Site.Params.Posts.pagesize }} + {{ $postsPaging := .Paginate $postsForPaging $postsPageSize }} <!-- Wrapper --> - <div id="wrapper" class="fade-in"> + <div id="wrapper" class="fade-in" data-pfn="{{ $postsFoldername }}" data-ps="{{ $postsPageSize }}" data-pfp="{{ $postsFeaturedPost }}"> {{ if eq $postsPaging.PageNumber 1 }} {{ partial "intro.html" . }} @@ -27,7 +30,7 @@ <!-- Main --> <div id="main"> - {{ if eq .Site.Params.Posts.featuredpost "true" }} + {{ if eq $postsFeaturedPost "true" }} {{ partial "posts/featured.html" (dict "firstpost" $firstPost "siteData" (index .Site.Data .Site.Language.Lang)) }} {{ end }} {{ partial "posts/list.html" (dict "posts" $postsPaging "siteData" (index .Site.Data .Site.Language.Lang)) }} |