diff --git a/config/_default/params.toml b/config/_default/params.toml index 654127eb7..cababf710 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -29,6 +29,7 @@ enableCodeCopy = false [homepage] layout = "page" # valid options: page, profile, custom showRecent = false + recentLimit = 5 [article] showDate = true diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml index c894ee3a7..68a412d55 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 a80b0f275..f3e5a8242 100644 --- a/exampleSite/content/docs/configuration.md +++ b/exampleSite/content/docs/configuration.md @@ -132,6 +132,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.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 be1cff894..e3266400c 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 5 (.Paginate (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) 5).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 }}