summaryrefslogtreecommitdiffstats
path: root/layouts/partials/mini-toc.html
diff options
context:
space:
mode:
authorSerghei Iakovlev <egrep@protonmail.ch>2022-05-28 11:12:09 +0200
committerSerghei Iakovlev <egrep@protonmail.ch>2022-05-28 11:12:09 +0200
commitb17ccbd2fa987395d42313a81b2227f5ec8d88ac (patch)
treef37523bae5f862f849b88e5c9d52e6eca0106e5d /layouts/partials/mini-toc.html
parent7bc1c366a3c812a6e6e93d570896de29480e6015 (diff)
downloadgohugo-theme-ed-b17ccbd2fa987395d42313a81b2227f5ec8d88ac.tar.gz
Rework the "Latest Publications" section
Diffstat (limited to 'layouts/partials/mini-toc.html')
-rw-r--r--layouts/partials/mini-toc.html26
1 files changed, 26 insertions, 0 deletions
diff --git a/layouts/partials/mini-toc.html b/layouts/partials/mini-toc.html
new file mode 100644
index 0000000..4d4d742
--- /dev/null
+++ b/layouts/partials/mini-toc.html
@@ -0,0 +1,26 @@
+{{/* 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") }}
+
+{{/* Create a variable with that section to use in multiple places. */}}
+{{ $section := where site.RegularPages "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 }}
+
+ <div class="toc" role="navigation">
+ {{/* TODO: Translate me */}}
+ <h2>Latest Publications</h2>
+ <ul class="texts">
+ {{/* Range through the first $mxPosts items of the $section */}}
+ {{ range (first $mxPosts $section) }}
+ <li class="text-title">
+ {{ partial "post-toc-summary" . }}
+ </li>
+ {{ end }}
+ </ul>
+ </div>
+{{ end }}