newsletter section: only show list when there are pages

This commit is contained in:
Reorx 2022-09-08 21:55:35 +08:00
parent 3f294daccf
commit bb02a60990
1 changed files with 5 additions and 2 deletions

View File

@ -12,10 +12,12 @@
{{- partial "newsletter_sub_form.html"}} {{- partial "newsletter_sub_form.html"}}
</div> </div>
<h2>最近更新</h2> {{ $pages := where .Pages "Params.hidden" "!=" true }}
{{ if $pages }}
<h2>最新通讯</h2>
<div class="list"> <div class="list">
{{- range first 5 (where .Pages "Params.hidden" "!=" true) }} {{- range first 5 $pages }}
<div class="item"> <div class="item">
<div class="date"> <div class="date">
{{- if not .Date.IsZero -}} {{- if not .Date.IsZero -}}
@ -32,6 +34,7 @@
</div> </div>
{{- end }} {{- end }}
</div> </div>
{{ end }}
<h2>相关链接</h2> <h2>相关链接</h2>
<div class="inline-links"> <div class="inline-links">