From b9f61f6896944768a3522d0d2620353d58f369cc Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Mon, 16 Aug 2021 10:42:48 +1000 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20option=20to=20toggle=20groupB?= =?UTF-8?q?yYear=20on=20list=20pages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + exampleSite/config.toml | 3 +++ layouts/_default/list.html | 6 ++++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 54164053..b5e19f25 100644 --- a/README.md +++ b/README.md @@ -251,6 +251,7 @@ Many of the article defaults here can be overridden on a per article basis by sp |`article.showHeadingAnchors`|boolean|`true`|Whether or not heading anchor links are displayed alongside headings within articles.| |`article.showPagination`|boolean|`true`|Whether or not the next/previous article links are displayed in the article footer.| |`article.showReadingTime`|boolean|`true`|Whether or not article reading times are displayed.| +|`list.groupByYear`|boolean|`true`|Whether or not articles are grouped under years in the article listing.| |`sitemap.excludedKinds`|array of strings|`["taxonomy", "term"]`|Kinds of content that should be excluded from the generated `/sitemap.xml` file. Refer to the [Hugo docs](https://gohugo.io/templates/section-templates/#page-kinds) for acceptable values.| |`taxonomy.showTermCount`|boolean|`true`|Whether or not the number of articles within a taxonomy term is displayed on the taxonomy listing.| |`fathomAnalytics.site`|string|_Not set_|The site code generated by Fathom Analytics for the website. Refer to the [Analytics docs](#analyticshtml) below for more details.| diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 400bf3f8..5f55c1a7 100755 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -26,6 +26,9 @@ title = "Congo" layout = "custom" showList = true +[params.list] + groupByYear = false + [[menu.main]] name = "Blog" pageRef = "blog" diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 2d5d6baa..1c8b0fbf 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -2,8 +2,10 @@ {{ partial "section-heading.html" . }}
{{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }} -

{{ .Key }}

-
+ {{ if $.Site.Params.list.groupByYear }} +

{{ .Key }}

+
+ {{ end }} {{ range .Pages }} {{ partial "article-link.html" . }} {{ end }}