Add option to toggle groupByYear on list pages

pull/2/head
James Panther 2021-08-16 10:42:48 +10:00
parent e293f4c509
commit b9f61f6896
No known key found for this signature in database
GPG Key ID: D36F789E45745D17
3 changed files with 8 additions and 2 deletions

View File

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

View File

@ -26,6 +26,9 @@ title = "Congo"
layout = "custom" layout = "custom"
showList = true showList = true
[params.list]
groupByYear = false
[[menu.main]] [[menu.main]]
name = "Blog" name = "Blog"
pageRef = "blog" pageRef = "blog"

View File

@ -2,8 +2,10 @@
{{ partial "section-heading.html" . }} {{ partial "section-heading.html" . }}
<section> <section>
{{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }} {{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }}
{{ if $.Site.Params.list.groupByYear }}
<h2 class="mt-12 text-2xl font-bold first:mt-8">{{ .Key }}</h2> <h2 class="mt-12 text-2xl font-bold first:mt-8">{{ .Key }}</h2>
<hr class="border-gray-400 border-dotted w-36" /> <hr class="border-gray-400 border-dotted w-36" />
{{ end }}
{{ range .Pages }} {{ range .Pages }}
{{ partial "article-link.html" . }} {{ partial "article-link.html" . }}
{{ end }} {{ end }}