From 6dd5ca8c29eb5f2536992828bc4e90fe7227dcfe Mon Sep 17 00:00:00 2001 From: Joel Grunbaum Date: Tue, 21 Sep 2021 17:42:52 +1000 Subject: [PATCH] Added option to disable category post listings on the home page --- README.md | 1 + layouts/partials/category-posts.html | 36 +++++++++++++++------------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index de808807..5aed0338 100644 --- a/README.md +++ b/README.md @@ -92,6 +92,7 @@ copyright = "© Copyright Year, Your Name" home_image = "/images/avatar.png" # Path to header image starting from the static directory recent_posts = 5 # Max amount of recent posts to show mainSections = ["posts", "post", "blog"] # Main sections to include in recent posts + category_list = true # Include category posts on the home page [params.style] # CSS style overrides backgroundColor = "#f8f9fa" fontColor = "#212529" diff --git a/layouts/partials/category-posts.html b/layouts/partials/category-posts.html index c3e83b2d..1efaedee 100644 --- a/layouts/partials/category-posts.html +++ b/layouts/partials/category-posts.html @@ -3,38 +3,40 @@
{{ $recent := 7 }} {{ if isset .Site.Params "recent_posts" }} - {{ $recent = .Site.Params.recent_posts }} + {{ $recent = .Site.Params.recent_posts }} {{ end }} {{ if gt $recent 0 }}
Recent
    {{ range first $recent (where .Site.RegularPages "Type" "in" site.Params.mainSections) }} -
  • - {{ .Date.Format "Jan 2 2006" }} - {{ .Title }} -
  • +
  • + {{ .Date.Format "Jan 2 2006" }} + {{ .Title }} +
  • {{ end }}
{{ end }} + {{ if or (not (isset .Site.Params "category_list")) (.Site.Params.category_list) }} {{ range $key, $taxonomy := .Site.Taxonomies.categories.Alphabetical }} -
-
+
+
{{ .Name | humanize }} -
-
    - {{ range $taxonomy.Pages }} -
  • - {{ .Date.Format "Jan 2 2006" }} - {{ .Title }} -
  • - {{ end }} -
-
+
+
    + {{ range $taxonomy.Pages }} +
  • + {{ .Date.Format "Jan 2 2006" }} + {{ .Title }} +
  • + {{ end }} +
+
+ {{ end }} {{ end }}