Optionally disable listing recent items in homepage

This commit is contained in:
Travis Chen 2020-05-24 12:21:00 -07:00
parent 58ba445c9f
commit f9f9abd98f
3 changed files with 5 additions and 1 deletions

View File

@ -98,6 +98,9 @@ paginate = 5
# it's set to `true` by default # it's set to `true` by default
# oneHeadingSize = false # oneHeadingSize = false
# list recent posts in the home page; default is true
# listRecentInHome = false
[params.twitter] [params.twitter]
# set Twitter handles for Twitter cards # set Twitter handles for Twitter cards
# see https://developer.twitter.com/en/docs/tweets/optimize-with-cards/guides/getting-started#card-and-content-attribution # see https://developer.twitter.com/en/docs/tweets/optimize-with-cards/guides/getting-started#card-and-content-attribution

View File

@ -9,6 +9,7 @@ paginate = 5
showMenuItems = 2 showMenuItems = 2
fullWidthTheme = false fullWidthTheme = false
centerTheme = false centerTheme = false
listRecentInHome = false
[languages] [languages]
[languages.en] [languages.en]

View File

@ -4,7 +4,7 @@
{{ $contentTypeName := cond $isntDefault (string $.Site.Params.contentTypeName) "posts" }} {{ $contentTypeName := cond $isntDefault (string $.Site.Params.contentTypeName) "posts" }}
{{ $PageContext := . }} {{ $PageContext := . }}
{{ if .IsHome }} {{ if and .IsHome (not (eq $.Site.Params.listRecentInHome false)) }}
{{ $PageContext = .Site }} {{ $PageContext = .Site }}
{{ end }} {{ end }}
{{ $paginator := .Paginate (where $PageContext.RegularPages "Type" $contentTypeName) }} {{ $paginator := .Paginate (where $PageContext.RegularPages "Type" $contentTypeName) }}