diff options
| author | Serghei Iakovlev <egrep@protonmail.ch> | 2022-05-27 16:24:27 +0200 |
|---|---|---|
| committer | Serghei Iakovlev <egrep@protonmail.ch> | 2022-05-27 16:24:27 +0200 |
| commit | f7d02ea440684931b68b18011f9de75d800f09f2 (patch) | |
| tree | 8c044e337a242d4424ae4df461a1547cdf897f13 /layouts/index.html | |
| parent | fd4234d9b5bed7e9894e26bbe5e9503f066ef904 (diff) | |
| download | gohugo-theme-ed-f7d02ea440684931b68b18011f9de75d800f09f2.tar.gz | |
Do not show "Latest Publications" if there are no publications
Diffstat (limited to 'layouts/index.html')
| -rw-r--r-- | layouts/index.html | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/layouts/index.html b/layouts/index.html index f0f88ae..7dde6eb 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,22 +1,27 @@ {{ define "main" }} +{{- $mainSections := site.Params.mainSections | default (slice "post") }} {{- with .Content }} <div class="introduction"> {{ . }} </div> + {{- $section := where site.RegularPages "Section" "in" $mainSections }} + {{- $section_count := len $section }} + {{- if ge $section_count 1 }} <hr> <div class="toc"> {{/* TODO: Translate me */}} <h2>Latest Publications</h2> <ul class="texts"> - {{ range first 10 (where site.RegularPages.ByDate.Reverse "Type" "in" site.Params.mainSections) }} + {{ range first 10 $section }} <li class="text-title"> <a href="{{ .Permalink }}">{{ .Title }}</a> </li> {{ end }} </ul> </div> + {{ end }} {{- else }} - {{ $paginator := .Paginate (where site.RegularPages "Type" "in" site.Params.mainSections) }} + {{ $paginator := .Paginate (where site.RegularPages "Section" "in" $mainSections) }} <div class="articles"> {{ with .Title }}<h1 class="page-title">{{ . }}</h1>{{ end }} {{ range $paginator.Pages }}{{- .Render "teaser" }}{{ end }} |
