From d6bd4f1afde8759127ffad3e1a85b91209c58301 Mon Sep 17 00:00:00 2001 From: James Turk Date: Mon, 2 Dec 2024 02:58:53 -0600 Subject: [PATCH] author CSS --- layouts/partials/article-meta/basic.html | 100 +++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 layouts/partials/article-meta/basic.html diff --git a/layouts/partials/article-meta/basic.html b/layouts/partials/article-meta/basic.html new file mode 100644 index 0000000..b1283e0 --- /dev/null +++ b/layouts/partials/article-meta/basic.html @@ -0,0 +1,100 @@ +{{/* Determine the correct context and scope */}} +{{/* This allows for different logic depending on where the partial is called */}} +{{ $context := . }} +{{ $scope := default nil }} + +{{ if (reflect.IsMap . ) }} + {{ $context = .context }} + {{ $scope = cond (not .scope) nil .scope }} +{{ end }} + +{{ with $context }} +{{ $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)) }} +{{else if and (eq $scope "single") (.Params.showDateOnlyInArticle | default (.Site.Params.article.showDateOnlyInArticle | default false)) }} + {{ $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)) (gt (.Lastmod | time.Format "2006") 1) }} + {{ $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 and (not .Params.externalURL) (.Params.showViews | default (.Site.Params.article.showViews | default false)) }} + {{ $meta.Add "partials" (slice (partial "meta/views.html" .)) }} +{{ end }} + +{{ if and (not .Params.externalURL) (.Params.showLikes | default (.Site.Params.article.showLikes | default false)) }} + {{ $meta.Add "partials" (slice (partial "meta/likes.html" .)) }} +{{ end }} + +{{ if and (eq $scope "single") (not .Params.externalURL) (.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 }} + +{{ if and (eq $scope "single") (.Params.showZenMode | default (.Site.Params.article.showZenMode | default false)) }} + {{ $meta.Add "partials" (slice (partial "meta/zen-mode.html" .)) }} +{{ end }} + + +
+ {{/* Output partials */}} + {{ with ($meta.Get "partials") }} + {{ delimit . "·" | safeHTML }} + {{ end }} + + {{/* Output draft label */}} + {{ if and (eq $scope "single") (and .Draft .Site.Params.article.showDraftLabel) }} + {{ partial "badge.html" (i18n "article.draft" | emojify) }} + {{ end }} +
+ +{{ if .Params.showAuthorsBadges | default (.Site.Params.article.showAuthorsBadges | default false) }} +
+ {{ range $taxonomy, $terms := .Site.Taxonomies }} + {{ if (eq $taxonomy "authors")}} + {{ if (gt (len ($context.GetTerms $taxonomy)) 0) }} + {{ range $i, $a := $context.GetTerms $taxonomy }} + + {{ if not (eq $i 0) }} ,  {{ end }}
{{ $a.LinkTitle }}
+ {{ end }} + {{ end }} + {{ end }} + {{ end }} +
+{{ end }} + +{{/* Output taxonomies */}} +{{ if .Params.showTaxonomies | default (.Site.Params.article.showTaxonomies | default false) }} +
+ {{ range $taxonomy, $terms := .Site.Taxonomies }} + {{ if and (not (eq $taxonomy "authors")) (not (eq $taxonomy "series"))}} + {{ if (gt (len ($context.GetTerms $taxonomy)) 0) }} + {{ range $context.GetTerms $taxonomy }} + + {{ partial "badge.html" .LinkTitle }} + + {{ end }} + {{ end }} + {{ end }} + {{ end }} +
+{{ end }} + +{{ end }}