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

github.com/xianmin/hugo-theme-jane.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaform <shaform@gmail.com>2018-11-17 22:18:02 +0300
committerShaform <shaform@gmail.com>2018-11-17 22:31:43 +0300
commitebfc3056a44ea0051a3e9008c572459d829d3c13 (patch)
treebb22725191f2c80b4730c17809425eaddabbb7c4 /layouts
parent45fc3e7ceb6621b97b3ea41ad91431b0dd4f6cc9 (diff)
add author info section
Diffstat (limited to 'layouts')
-rw-r--r--layouts/partials/author_info.html24
-rw-r--r--layouts/post/single.html5
2 files changed, 29 insertions, 0 deletions
diff --git a/layouts/partials/author_info.html b/layouts/partials/author_info.html
new file mode 100644
index 0000000..f776c37
--- /dev/null
+++ b/layouts/partials/author_info.html
@@ -0,0 +1,24 @@
+{{- with $author := index (.context.Site.Data.authors | default dict) .author -}}
+ {{- $author_lang := index $author $.context.Site.Language.Lang | default $author -}}
+ {{- $author_name := $author_lang.name.display | default $author.name.display | default $.author -}}
+ {{- $author_desc := $author_lang.description | default $author.description -}}
+ {{- $author_image := $author_lang.image | default $author.image | default (dict "url" "image/blank-profile.png") -}}
+ {{- $author_url := $author_lang.url | default $author.url | default ((($.context.Site.GetPage "taxonomy" (printf "author/%s" $.author)) | default dict).Permalink) -}}
+<section class="author-info">
+ <div class="author-box">
+ <div class="author-image">
+ {{- with $author_url -}}<a href="{{ $author_url | relLangURL }}">{{- end -}}
+ <img src="{{ $author_image.url | relURL }}" alt="{{ $author_name }}" width="{{ $author_image.width | default 128 }}" height="{{ $author_image.height | default 128 }}"/>
+ {{- with $author_url -}}</a>{{- end -}}
+ </div>
+ <div class="author-content">
+ <p class="author-title">{{ i18n "author" }}</p>
+ <p class="author-name">{{ $author_name }}</p>
+ {{ with $author_desc -}}
+ <p class="author-desc">{{ . }}</p>
+ {{- end }}
+ </div>
+ <div class="author-bottom"></div>
+ </div>
+</section>
+{{- end -}}
diff --git a/layouts/post/single.html b/layouts/post/single.html
index 4835c85..b523af6 100644
--- a/layouts/post/single.html
+++ b/layouts/post/single.html
@@ -93,6 +93,11 @@
</footer>
</article>
+ <!-- Author Info -->
+ {{ if and (.Params.author | default .Site.Author.name) (.Params.showAuthorInfo | default .Site.Params.showAuthorInfo) }}
+ {{ partial "author_info.html" (dict "author" (.Params.author | default .Site.Author.name) "context" $) }}
+ {{ end }}
+
<!-- Comments -->
{{ partial "comments.html" . }}
{{- end }}