From f9f9abd98fa65fd17b5c1b1dd417a8a735d0d33a Mon Sep 17 00:00:00 2001 From: Travis Chen Date: Sun, 24 May 2020 12:21:00 -0700 Subject: [PATCH] Optionally disable listing recent items in homepage --- README.md | 3 +++ exampleSite/config.toml | 1 + layouts/_default/list.html | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d86448a..d9efb3b 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,9 @@ paginate = 5 # it's set to `true` by default # oneHeadingSize = false + # list recent posts in the home page; default is true + # listRecentInHome = false + [params.twitter] # set Twitter handles for Twitter cards # see https://developer.twitter.com/en/docs/tweets/optimize-with-cards/guides/getting-started#card-and-content-attribution diff --git a/exampleSite/config.toml b/exampleSite/config.toml index bec37f5..0337364 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -9,6 +9,7 @@ paginate = 5 showMenuItems = 2 fullWidthTheme = false centerTheme = false + listRecentInHome = false [languages] [languages.en] diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 4936e7b..b5c4b26 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -4,7 +4,7 @@ {{ $contentTypeName := cond $isntDefault (string $.Site.Params.contentTypeName) "posts" }} {{ $PageContext := . }} - {{ if .IsHome }} + {{ if and .IsHome (not (eq $.Site.Params.listRecentInHome false)) }} {{ $PageContext = .Site }} {{ end }} {{ $paginator := .Paginate (where $PageContext.RegularPages "Type" $contentTypeName) }}