diff --git a/config/_default/params.toml b/config/_default/params.toml index 4f099aa2..b6b05bb9 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -24,6 +24,9 @@ enableCodeCopy = true [homepage] layout = "profile" # valid options: page, profile, custom showRecent = false + showRecentItems = 5 + showMoreLink = false + showMoreLinkDest = "/posts" [article] showDate = true diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml index 8b6073ec..3ba885d4 100644 --- a/exampleSite/config/_default/params.toml +++ b/exampleSite/config/_default/params.toml @@ -25,6 +25,8 @@ mainSections = ["docs", "samples"] layout = "custom" # valid options: page, profile, custom showRecent = false showRecentItems = 5 + showMoreLink = false + showMoreLinkDest = "/docs" [article] showDate = true diff --git a/exampleSite/content/docs/configuration/index.md b/exampleSite/content/docs/configuration/index.md index 6b95d2a6..b29f23b9 100644 --- a/exampleSite/content/docs/configuration/index.md +++ b/exampleSite/content/docs/configuration/index.md @@ -137,6 +137,8 @@ Many of the article defaults here can be overridden on a per article basis by sp |`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|How many articles to display if showRecent is true. If variable is set to 0 or if it isn't defined the system will default to 5 articles.| +|`homepage.showMoreLink`|'false'|Wether or not to display a show more link at the end of your posts that takes the user to a predefined place.| +|`homepage.showMoreLinkDest`|'/posts'|The destination of the show more button.| |`article.showDate`|`true`|Whether or not article dates are displayed.| |`article.showViews`|`false`|Whether or not article views are displayed. This requires firebase integrations to be enabled, look below.| |`article.showDateUpdated`|`false`|Whether or not the dates articles were updated are displayed.| diff --git a/layouts/partials/recent-articles.html b/layouts/partials/recent-articles.html index ba0dc91d..925df880 100644 --- a/layouts/partials/recent-articles.html +++ b/layouts/partials/recent-articles.html @@ -1,4 +1,5 @@ {{ $recentArticles := 5 }} +{{ $showMoreLinkDest := "/posts" }} {{ if .Site.Params.homepage.showRecent | default false }} {{ if index .Site.Params.homepage "showRecentItems" }} {{ $recentArticles = .Site.Params.homepage.showRecentItems }} @@ -7,4 +8,14 @@ {{ range first $recentArticles (.Paginate (where .Site.RegularPages "Type" "in" .Site.Params.mainSections)).Pages }} {{ partial "article-link.html" . }} {{ end }} + {{ if .Site.Params.homepage.showMoreLink | default false }} + {{ if index .Site.Params.homepage "showRecentItems" }} + {{ $showMoreLinkDest = .Site.Params.homepage.showMoreLinkDest }} + {{ end }} +