From 5341773f4831960706446569675449217937aa6a Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sun, 29 May 2022 10:40:02 +0200 Subject: Provide ability to get list of all posts --- layouts/page/all-posts.html | 22 ++++++++++++++++++++++ layouts/partials/mini-toc.html | 19 ++++++++++++++----- 2 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 layouts/page/all-posts.html (limited to 'layouts') diff --git a/layouts/page/all-posts.html b/layouts/page/all-posts.html new file mode 100644 index 0000000..a26b084 --- /dev/null +++ b/layouts/page/all-posts.html @@ -0,0 +1,22 @@ +{{ define "main" }} +{{/* Define a section to pull recent posts from. + This will default to the section with the most number of pages. */}} +{{ $mainSections := site.Params.mainSections | default (slice "posts") }} + +{{/* Create a variable with that section to use in multiple places. */}} +{{ $section := where site.RegularPages.ByDate.Reverse "Section" "in" $mainSections }} + +
+ {{ with .Title }}

{{ . }}

{{ end }} + + {{ with .Content }} +
+ {{ .Content }} +
+ {{ end }} + + {{ range $section }} + {{ .Render "teaser" }} + {{ end }} +
+{{ end }} diff --git a/layouts/partials/mini-toc.html b/layouts/partials/mini-toc.html index 629169b..6b52f47 100644 --- a/layouts/partials/mini-toc.html +++ b/layouts/partials/mini-toc.html @@ -1,25 +1,34 @@ {{/* Define a section to pull recent posts from. This will default to the section with the most number of pages. */}} -{{ $mainSections := site.Params.mainSections | default (slice "post") }} +{{ $mainSections := site.Params.mainSections | default (slice "posts") }} {{/* Create a variable with that section to use in multiple places. */}} -{{ $section := where site.RegularPages "Section" "in" $mainSections }} +{{ $section := where site.RegularPages.ByDate.Reverse "Section" "in" $mainSections }} {{/* Check to see if the section is defined for ranging through it */}} {{ $sectionCount := len $section }} {{ if ge $sectionCount 1 }} - {{ $mxPosts := site.Params.recentPostsSize | default 5 }} + {{ $maxPosts := site.Params.recentPostsSize | default 5 }} {{ end }} -- cgit v1.2.3