♻️ Rename `showRecentItems` to `recentLimit`

pull/428/head
James Panther 2023-01-10 15:19:03 +11:00
parent 1cb30ff9b2
commit 172ac4fc9a
No known key found for this signature in database
GPG Key ID: D36F789E45745D17
4 changed files with 4 additions and 3 deletions

View File

@ -29,7 +29,7 @@ enableCodeCopy = false
[homepage]
layout = "page" # valid options: page, profile, custom
showRecent = false
showRecentItems = 10
recentLimit = 5
[article]
showDate = true

View File

@ -29,6 +29,7 @@ mainSections = ["samples"]
[homepage]
layout = "custom" # valid options: page, profile, custom
showRecent = true
recentLimit = 5
[article]
showDate = true

View File

@ -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.|

View File

@ -1,6 +1,6 @@
{{ if .Site.Params.homepage.showRecent | default false }}
<h2 class="mt-8 text-2xl font-extrabold">{{ i18n "shortcode.recent_articles" | emojify }}</h2>
{{ 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 }}