diff --git a/layouts/partials/article-meta.html b/layouts/partials/article-meta.html index b8f59a58..c24633c7 100644 --- a/layouts/partials/article-meta.html +++ b/layouts/partials/article-meta.html @@ -4,72 +4,78 @@ {{ $scope := default nil }} {{ if (reflect.IsMap . ) }} - {{ $context = .context }} - {{ $scope = cond (not .scope) nil .scope }} +{{ $context = .context }} +{{ $scope = cond (not .scope) nil .scope }} {{ end }} {{ with $context }} - {{ $meta := newScratch }} +{{ $meta := newScratch }} - {{/* Gather partials for this context */}} - {{ if .Params.showDate | default (.Site.Params.article.showDate | default true) }} - {{ $meta.Add "partials" (slice (partial "meta/date.html" .Date)) }} +{{/* Gather partials for this context */}} +{{ if .Params.showDate | default (.Site.Params.article.showDate | default true) }} +{{ $meta.Add "partials" (slice (partial "meta/date.html" .Date)) }} +{{ end }} + +{{ if and (.Params.showDateUpdated | default (.Site.Params.article.showDateUpdated | default false)) (ne (partial +"functions/date.html" .Date) (partial "functions/date.html" .Lastmod)) }} +{{ $meta.Add "partials" (slice (partial "meta/date-updated.html" .Lastmod)) }} +{{ end }} + +{{ if and (.Params.showWordCount | default (.Site.Params.article.showWordCount | default false)) (ne .WordCount 0) }} +{{ $meta.Add "partials" (slice (partial "meta/word-count.html" .)) }} +{{ end }} + +{{ if and (.Params.showReadingTime | default (.Site.Params.article.showReadingTime | default true)) (ne .ReadingTime 0) +}} +{{ $meta.Add "partials" (slice (partial "meta/reading-time.html" .)) }} +{{ end }} + +{{ if (.Params.showViews | default (.Site.Params.article.showViews | default false)) }} +{{ $meta.Add "partials" (slice (partial "meta/views.html" .)) }} +{{ end }} + +{{ if (.Params.showLikes | default (.Site.Params.article.showLikes | default false)) }} +{{ $meta.Add "partials" (slice (partial "meta/likes.html" .)) }} +{{ end }} + +{{ if and (eq $scope "single") (.Params.showLikes | default (.Site.Params.article.showLikes | default false)) }} +{{ $meta.Add "partials" (slice (partial "meta/likes_button.html" .)) }} +{{ end }} + +{{ if and (eq $scope "single") (.Params.showEdit | default (.Site.Params.article.showEdit | default false)) }} +{{ $meta.Add "partials" (slice (partial "meta/edit.html" .)) }} +{{ end }} + + +
+ {{/* Output partials */}} + {{ with ($meta.Get "partials") }} + {{ delimit . "·" }} {{ end }} - {{ if and (.Params.showDateUpdated | default (.Site.Params.article.showDateUpdated | default false)) (ne (partial "functions/date.html" .Date) (partial "functions/date.html" .Lastmod)) }} - {{ $meta.Add "partials" (slice (partial "meta/date-updated.html" .Lastmod)) }} - {{ end }} - - {{ if and (.Params.showWordCount | default (.Site.Params.article.showWordCount | default false)) (ne .WordCount 0) }} - {{ $meta.Add "partials" (slice (partial "meta/word-count.html" .)) }} - {{ end }} - - {{ if and (.Params.showReadingTime | default (.Site.Params.article.showReadingTime | default true)) (ne .ReadingTime 0) }} - {{ $meta.Add "partials" (slice (partial "meta/reading-time.html" .)) }} - {{ end }} - - {{ if (.Params.showViews | default (.Site.Params.article.showViews | default false)) }} - {{ $meta.Add "partials" (slice (partial "meta/views.html" .)) }} - {{ end }} - - {{ if (.Params.showLikes | default (.Site.Params.article.showLikes | default false)) }} - {{ $meta.Add "partials" (slice (partial "meta/likes.html" .)) }} - {{ end }} - - {{ if and (eq $scope "single") (.Params.showLikes | default (.Site.Params.article.showLikes | default false)) }} - {{ $meta.Add "partials" (slice (partial "meta/likes_button.html" .)) }} - {{ end }} - - {{ if and (eq $scope "single") (.Params.showEdit | default (.Site.Params.article.showEdit | default false)) }} - {{ $meta.Add "partials" (slice (partial "meta/edit.html" .)) }} + {{/* Output draft label */}} + {{ if and (eq $scope "single") (and .Draft .Site.Params.article.showDraftLabel) }} + {{ partial "badge.html" (i18n "article.draft" | emojify) }} {{ end }} -
- {{/* Output partials */}} - {{ with ($meta.Get "partials") }} - {{ delimit . "·" }} - {{ end }} - - {{/* Output draft label */}} - {{ if and (eq $scope "single") (and .Draft .Site.Params.article.showDraftLabel) }} - {{ partial "badge.html" (i18n "article.draft" | emojify) }} - {{ end }} - - {{/* Output taxonomies */}} - {{ if .Params.showTaxonomies | default (.Site.Params.article.showTaxonomies | default false) }} - {{ range $taxonomy, $terms := .Site.Taxonomies }} - {{ if (gt (len ($context.GetTerms $taxonomy)) 0) }} - {{ range $context.GetTerms $taxonomy }} - - {{ partial "badge.html" .LinkTitle }} - - {{ end }} - {{ end }} - {{ end }} - {{ end }} {{ end }} -
+
+{{/* Output taxonomies */}} +{{ if .Params.showTaxonomies | default (.Site.Params.article.showTaxonomies | default false) }} +
+ + {{ range $taxonomy, $terms := .Site.Taxonomies }} + {{ if (gt (len ($context.GetTerms $taxonomy)) 0) }} + {{ range $context.GetTerms $taxonomy }} + + {{ partial "badge.html" .LinkTitle }} + + {{ end }} + {{ end }} + {{ end }} +
+{{ end }} \ No newline at end of file diff --git a/layouts/partials/badge.html b/layouts/partials/badge.html index da80c6c3..fef54a05 100644 --- a/layouts/partials/badge.html +++ b/layouts/partials/badge.html @@ -1,6 +1,6 @@ {{ . }}