From 0038cc1f58dcfe8b331976448b041a20d2a072f1 Mon Sep 17 00:00:00 2001 From: vimux Date: Sun, 18 Nov 2018 11:00:23 -0500 Subject: [PATCH] Add authorbox --- README.md | 6 ++++++ layouts/_default/baseof.html | 1 - layouts/_default/single.html | 1 + layouts/partials/authorbox.html | 21 +++++++++++++++++++++ static/css/main.css | 24 ++++++++++++++++++++++++ static/img/avatar.png | Bin 0 -> 428 bytes 6 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 layouts/partials/authorbox.html create mode 100644 static/img/avatar.png diff --git a/README.md b/README.md index 4be9820..8a02716 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,11 @@ theme = "binario" disqusShortname = "" # Enable comments by entering your Disqus shortname googleAnalytics = "" # Enable Google Analytics by entering your tracking id +[Author] # Used in authorbox + name = "John Doe" + bio = "John Doe's true identity is unknown. Maybe he is a successful blogger or writer." + avatar = "img/avatar.png" + [Params] author = "John Doe" # Used in meta author. Optional description = "Responsive card-based & code-light Hugo theme" # Description of your site. Used in meta description @@ -87,6 +92,7 @@ googleAnalytics = "" # Enable Google Analytics by entering your tracking id mainSections = ["post"] # Set main page sections post_meta = ["date", "categories"] # Enable post meta fields in given order dateFormat = "January 02, 2006" # Change the format of dates + authorbox = true # Show authorbox at bottom of single pages if true toc = true # Enable Table of Contents for all site pages tocOpen = true # Open Table of Contents block. Optional comments = true # Enable comments for all site pages diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index a7a0bca..34d6d97 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -8,7 +8,6 @@ {{ if not .IsHome }}{{ .Title }} | {{ end }}{{ .Site.Title }} - {{ with .Site.Params.author }}{{ end }} {{ if .Site.Params.opengraph }}{{ template "_internal/opengraph.html" . }}{{ end }} {{ if .Site.Params.twitter_cards }}{{ template "_internal/twitter_cards.html" . }}{{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index e1c2f2b..0f77667 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -16,6 +16,7 @@ + {{ partial "authorbox.html" . }} {{ partial "related.html" . }} {{ partial "comments.html" . }} {{ end }} \ No newline at end of file diff --git a/layouts/partials/authorbox.html b/layouts/partials/authorbox.html new file mode 100644 index 0000000..8f51823 --- /dev/null +++ b/layouts/partials/authorbox.html @@ -0,0 +1,21 @@ +{{- if .Param "authorbox" }} +
+
+ {{- with .Site.Author.avatar }} +
+ {{ $.Site.Author.name }} avatar +
+ {{- end }} +
+
+ {{ .Site.Author.name }} +
+ {{- with .Site.Author.bio }} +
+ {{- . -}} +
+ {{- end }} +
+
+
+{{- end }} \ No newline at end of file diff --git a/static/css/main.css b/static/css/main.css index 3823a17..73934d9 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -816,6 +816,30 @@ mark { text-align: center; } +/* Authorbox */ +.author { + display: flex; + align-items: flex-start; +} + +.author__avatar { + margin-right: .875rem; + margin-bottom: 0; +} + +.author__img { + border-radius: 50%; +} + +.author__body { + flex: 1; +} + +.author__name { + margin-bottom: .625rem; + font-weight: 700; +} + /* Comments */ .comments { margin-top: .625rem; diff --git a/static/img/avatar.png b/static/img/avatar.png new file mode 100644 index 0000000000000000000000000000000000000000..c1eb30f378fc9955a9277c7667541f3a49d79ce4 GIT binary patch literal 428 zcmV;d0aN~oP)3v-BHg$Lk;5ytwaDO@RzxeAs`$ zW4aHT(>!?#0G2-D#=U5cg#V)X>_BgXx6vljB7B)k4fH|CHl12}HV|^FispcVf`Vp` zqWoD)9~OnVQ>Jw?;JAwRsK|2#9Z*#$r&m