Don't generate empty div.post__meta

This commit is contained in:
vimux 2018-11-16 09:50:56 -05:00
parent 228a06dc5f
commit 6f847bd6d1
No known key found for this signature in database
GPG key ID: 5A34FDC4EE832E34
3 changed files with 10 additions and 8 deletions

View file

@ -3,7 +3,7 @@
<div class="single block"> <div class="single block">
<article class="post"> <article class="post">
{{- partial "post_thumbnail.html" (dict "page" . ) }} {{- partial "post_thumbnail.html" (dict "page" . ) }}
<div class="post__meta meta mb">{{ partial "post_meta.html" . }}</div> {{- partial "post_meta.html" (dict "dot" . "class" "mb") }}
<h1 class="post__title">{{ .Title }}</h1> <h1 class="post__title">{{ .Title }}</h1>
{{- partial "post_toc.html" . }} {{- partial "post_toc.html" . }}
<div class="post__content">{{ .Content }}</div> <div class="post__content">{{ .Content }}</div>

View file

@ -2,5 +2,5 @@
{{- partial "post_thumbnail.html" (dict "page" . ) }} {{- partial "post_thumbnail.html" (dict "page" . ) }}
<h1 class="post__title title-excerpt"><a class="post__title-link" href="{{ .RelPermalink }}">{{ .Title }}</a></h1> <h1 class="post__title title-excerpt"><a class="post__title-link" href="{{ .RelPermalink }}">{{ .Title }}</a></h1>
<div class="post__content">{{- .Summary }}</div> <div class="post__content">{{- .Summary }}</div>
<div class="post__meta meta mt tar">{{ partial "post_meta.html" . }}</div> {{- partial "post_meta.html" (dict "dot" . "class" "mt tar") }}
</article> </article>

View file

@ -1,7 +1,9 @@
{{ $currentPage := . }} {{ $currentPage := .dot }}
{{- with .Param "post_meta" }} {{- if .dot.Param "post_meta" }}
{{- range $metaField := . -}} <div class="post__meta meta {{ .class }}">
{{- range $metaField := .dot.Param "post_meta" -}}
{{- $metaFieldPath := printf "post_meta/%s.html" $metaField -}} {{- $metaFieldPath := printf "post_meta/%s.html" $metaField -}}
{{- partial $metaFieldPath $currentPage -}} {{- partial $metaFieldPath $currentPage -}}
{{ end }} {{ end }}
</div>
{{ end }} {{ end }}