diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 3943a4a..3a61d45 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -17,6 +17,8 @@ title = "Example Site" favicon = "" [params.widgets] enabled = ['archive', 'tag-cloud'] + [params.widgets.archive] + limit = 5 [params.widgets.tagCloud] limit = 10 [params.opengraph] diff --git a/layouts/partials/widget/archive.html b/layouts/partials/widget/archive.html index cfe02df..e5363c7 100644 --- a/layouts/partials/widget/archive.html +++ b/layouts/partials/widget/archive.html @@ -7,7 +7,9 @@ {{ $v1 := where .Site.RegularPages "Section" "post" }} {{ $v2 := where .Site.RegularPages "Params.hidden" "!=" true }} {{ $filtered := $v1 | intersect $v2 }} - {{ range $filtered.GroupByDate "2006" }} + {{ $archive := $filtered.GroupByDate "2006" }} + + {{ range first .Site.Params.widgets.archive.limit ($archive) }} {{ $id := lower (replace .Key " " "-") }}
@@ -16,4 +18,12 @@
{{ end }} + + {{ if gt (len $archive) .Site.Params.widgets.archive.limit }} +
+ + More + +
+ {{ end }}