diff options
| author | Serghei Iakovlev <egrep@protonmail.ch> | 2022-05-29 10:40:02 +0200 |
|---|---|---|
| committer | Serghei Iakovlev <egrep@protonmail.ch> | 2022-05-29 10:40:15 +0200 |
| commit | 5341773f4831960706446569675449217937aa6a (patch) | |
| tree | 96a69147c1d02f0b2ddf235d0169aa0d8f60b401 /layouts/partials | |
| parent | 8dee2d1294b1f045621ebb93b1f9407d6fccd5ec (diff) | |
| download | gohugo-theme-ed-5341773f4831960706446569675449217937aa6a.tar.gz | |
Provide ability to get list of all posts
Diffstat (limited to 'layouts/partials')
| -rw-r--r-- | layouts/partials/mini-toc.html | 19 |
1 files changed, 14 insertions, 5 deletions
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 }} <div class="toc" role="navigation"> <h2>{{ i18n "latest_publications" }}</h2> <ul class="texts"> - {{/* Range through the first $mxPosts items of the $section */}} - {{ range (first $mxPosts $section) }} + {{/* Range through the first $maxPosts items of the $section */}} + {{ range (first $maxPosts $section) }} <li class="text-title"> {{ partial "post-toc-summary" . }} </li> {{ end }} </ul> + + {{ if gt $sectionCount $maxPosts }} + <p> + <a href="{{ "all-posts" | relURL }}"> + {{ i18n "all_publications" }} + <span aria-hidden="true">→</span> + </a> + </p> + {{ end }} </div> {{ end }} |
