Permalink
Browse files

add author info section

  • Loading branch information...
shaform committed Nov 17, 2018
1 parent 45fc3e7 commit ebfc3056a44ea0051a3e9008c572459d829d3c13
@@ -0,0 +1,70 @@
// ==============================
// Author Info
// ==============================
.author-info {
margin: 0 5em 3em 5em;
background-color: white;
padding: 2em 5em 2em 5em;
text-align: center;
.author-box {
.author-image img {
margin: 1em auto 1em auto;
border-radius: 50%;
border: 1px solid #999;
float: left;
}
.author-content {
padding-left: 200px;
text-align: left;
.author-title {
color: #aaa;
margin-bottom: 0.1em;
font-size: 14px;
}
.author-name {
font-weight: bold;
margin-top: 0em;
margin-bottom: 0.5em;
}
.author-desc {
font-size: 16px;
}
}
.author-bottom {
clear: both;
}
}
}
@media screen and (min-width: 900px) and (max-width: 1080px) {
.author-info {
margin: 0 2em 2em 2em;
}
}
@media screen and (min-width: 504px) and (max-width: 899px) {
.author-info {
margin: 0 1em 2em 1em;
padding-left: 1em;
padding-right: 1em;
}
}
@media screen and (max-width: 504px) {
.author-info {
margin: 0 0 2em 0;
padding: 1em;
.author-box {
.author-image img {
float: none;
}
.author-content {
padding-left: 0;
text-align: center;
}
}
}
}
@@ -17,3 +17,4 @@
@import "_partial/mobile";
@import "_partial/back-to-top";
@import "_partial/404";
@import "_partial/author_info";
@@ -1,2 +1,15 @@
description = "Writer, Traveler, Food Lover."
[name]
display = "Ted Williams"
# [image]
# url = ""
# width = 128
# height = 128
# [en]
# description = ""
# [en.name]
# display = "Ted"
@@ -91,6 +91,8 @@ defaultContentLanguage = "en" # Default language to use
# show language chooser in menu
showMenuLanguageChooser = true
showAuthorInfo = true # show author info below the article
# 一些全局开关,你也可以在每一篇内容的 front matter 中针对单篇内容关闭或开启某些功能,在 archetypes/default.md 查看更多信息。
# Some global options, you can also close or open something in front matter for a single post, see more information from `archetypes/default.md`.
toc = true # 是否开启目录
@@ -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 -}}
@@ -93,6 +93,11 @@ <h1 class="post-title">{{ .Title }}</h1>
</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 }}

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -1 +1 @@
{"Target":"sass/jane.min.14adaa9e98ff1655bafd0728e49aaeec54413095a880475b7621f14ae200d777.css","MediaType":"text/css","Data":{"Integrity":"sha256-FK2qnpj/FlW6/Qco5Jqu7FRBMJWogEdbdiHxSuIA13c="}}
{"Target":"sass/jane.min.aaf3394fc81ccb6f6fe3fe458d1f5b61c39f151e44df83baaf1d7b3775a8b98d.css","MediaType":"text/css","Data":{"Integrity":"sha256-qvM5T8gcy29v4/5FjR9bYcOfFR5E34O6rx17N3WouY0="}}
Binary file not shown.

0 comments on commit ebfc305

Please sign in to comment.