From 172ac4fc9abfe9cd6744cf432a82b0b1f58e5b8c Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Tue, 10 Jan 2023 15:19:03 +1100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20=20Rename=20`showRecentIte?= =?UTF-8?q?ms`=20to=20`recentLimit`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/_default/params.toml | 2 +- exampleSite/config/_default/params.toml | 1 + exampleSite/content/docs/configuration.md | 2 +- layouts/partials/recent-articles.html | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/config/_default/params.toml b/config/_default/params.toml index e0aae143..c870307f 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -29,7 +29,7 @@ enableCodeCopy = false [homepage] layout = "page" # valid options: page, profile, custom showRecent = false - showRecentItems = 10 + recentLimit = 5 [article] showDate = true diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml index f0618869..b36d4983 100644 --- a/exampleSite/config/_default/params.toml +++ b/exampleSite/config/_default/params.toml @@ -29,6 +29,7 @@ mainSections = ["samples"] [homepage] layout = "custom" # valid options: page, profile, custom showRecent = true + recentLimit = 5 [article] showDate = true diff --git a/exampleSite/content/docs/configuration.md b/exampleSite/content/docs/configuration.md index 71e6574f..f2887c57 100644 --- a/exampleSite/content/docs/configuration.md +++ b/exampleSite/content/docs/configuration.md @@ -133,7 +133,7 @@ Many of the article defaults here can be overridden on a per article basis by sp |`footer.showScrollToTop`|`true`|When set to `true` the scroll to top arrow is displayed.| |`homepage.layout`|`"page"`|The layout of the homepage. Valid values are `page`, `profile` or `custom`. When set to `custom`, you must provide your own layout by creating a `/layouts/partials/home/custom.html` file. Refer to the [Homepage Layout]({{< ref "homepage-layout" >}}) section for more details.| |`homepage.showRecent`|`false`|Whether or not to display the recent articles list on the homepage.| -|`homepage.showRecentItems`|`5`|The number of recent articles to display.| +|`homepage.recentLimit`|`5`|The maximum number of recent articles to display when `homepage.showRecent` is `true`.| |`article.showDate`|`true`|Whether or not article dates are displayed.| |`article.showDateUpdated`|`false`|Whether or not the dates articles were updated are displayed.| |`article.showAuthor`|`true`|Whether or not the author box is displayed in the article footer.| diff --git a/layouts/partials/recent-articles.html b/layouts/partials/recent-articles.html index 2e8c6179..e3266400 100644 --- a/layouts/partials/recent-articles.html +++ b/layouts/partials/recent-articles.html @@ -1,6 +1,6 @@ {{ if .Site.Params.homepage.showRecent | default false }}

{{ i18n "shortcode.recent_articles" | emojify }}

- {{ range first .Site.Params.homepage.showRecentItems (.Paginate (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) .Site.Params.homepage.showRecentItems).Pages }} + {{ range first .Site.Params.homepage.recentLimit (.Paginate (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) .Site.Params.homepage.recentLimit).Pages }} {{ partial "article-link.html" . }} {{ end }} {{ end }}