Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/shaform/hugo-theme-den.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaform <shaform@gmail.com>2018-11-17 06:00:07 +0300
committerShaform <shaform@gmail.com>2018-11-17 06:00:07 +0300
commit0ebd7323f87e083cfa957801c5a4849f120b0527 (patch)
tree2779e28d4f7ecc1377c6432318103b0ffa783e55 /layouts
parent93536adba00dd2dabde35c660253353ddf86724a (diff)
support author information
Diffstat (limited to 'layouts')
-rw-r--r--layouts/partials/author_card.html24
-rw-r--r--layouts/posts/single.html7
2 files changed, 30 insertions, 1 deletions
diff --git a/layouts/partials/author_card.html b/layouts/partials/author_card.html
new file mode 100644
index 0000000..d795525
--- /dev/null
+++ b/layouts/partials/author_card.html
@@ -0,0 +1,24 @@
+{{- with $author := index .context.Site.Data.authors .author -}}
+ {{- $author_lang := index $author $.context.Site.LanguageCode | default $author -}}
+ {{- $author_name := $author_lang.name.display | default $author.name.display | default $.author -}}
+ {{- $author_desc := $author_lang.description | default $author.description | default $.author -}}
+ {{- $author_image := $author_lang.image.url | default $author.image.url | default "images/blank-profile.png" -}}
+ {{- $author_url := $author_lang.url | default $author.url -}}
+ <div class="author-card">
+ <div class="underline"></div>
+ <div class="author-box">
+ <div class="author-image">
+ {{- with $author_url -}}
+ <a href="{{ $author_url | relURL }}"><img src="{{ $author_image | relURL }}" /></a>
+ {{- else -}}
+ <img src="{{ $author_image | relURL }}" />
+ {{- end -}}
+ </div>
+ <div class="author-content">
+ <p class="author-title">{{ i18n "author" }}</p>
+ <p class="author-name">{{ $author_name }}</p>
+ <p class="author-desc">{{ $author_desc }}</p>
+ </div>
+ </div>
+ </div>
+{{- end -}}
diff --git a/layouts/posts/single.html b/layouts/posts/single.html
index 5f6a191..8f42523 100644
--- a/layouts/posts/single.html
+++ b/layouts/posts/single.html
@@ -9,7 +9,7 @@
{{- $last := (sub (len .Params.authors) 1) -}}
{{- i18n "author_by" }}
{{ range $index, $value := .Params.authors -}}
- {{ $value }}{{ if ne $index $last }}, {{ end -}}
+ {{ (index (index $.Site.Data.authors $value) $.Site.LanguageCode).name.display | default (index $.Site.Data.authors $value).name.display | default $value }}{{ if ne $index $last }}, {{ end -}}
{{ end }} /
{{ end }}
{{ .Date.Format (.Site.Params.dateFormatToUse | default "Mon 02 January 2006") -}}
@@ -71,6 +71,11 @@
</dl>
{{ end }}
{{ end }}
+ {{ if (.Params.showAuthorCard | default .Site.Params.showAuthorCard) }}
+ {{ range .Params.authors }}
+ {{ partial "author_card.html" (dict "author" . "context" $) }}
+ {{ end }}
+ {{ end }}
{{ partial "comments.html" . }}
</div>
{{ end }}