From 5517dae23ab0dda2deb18f71e57f8225cb78ac33 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Le Duigou Date: Wed, 24 Jun 2020 09:27:28 +0200 Subject: [PATCH] If no author specified in blog post, it should default to site author (#6) * Author name should default to site author If author name is not present in the blog post it should default to site author * Default to site author If author image is not present in the blog post, it should default to the site author --- layouts/partials/helpers/get-author-image.html | 3 +++ layouts/partials/helpers/get-author-name.html | 3 +++ 2 files changed, 6 insertions(+) diff --git a/layouts/partials/helpers/get-author-image.html b/layouts/partials/helpers/get-author-image.html index 9a324a3..9ab6360 100644 --- a/layouts/partials/helpers/get-author-image.html +++ b/layouts/partials/helpers/get-author-image.html @@ -1,4 +1,7 @@ {{ $authorImage:= "/assets/images/default-avatar.png"}} +{{ if .Site.Data.site.author}} + {{ $authorImage = .Site.Data.site.author.image | relURL }} +{{ end}} {{ if eq (printf "%T" .Params.author ) "maps.Params" }} {{ with .Params.author }} {{ if .image }} diff --git a/layouts/partials/helpers/get-author-name.html b/layouts/partials/helpers/get-author-name.html index e15075c..2bcf239 100644 --- a/layouts/partials/helpers/get-author-name.html +++ b/layouts/partials/helpers/get-author-name.html @@ -1,4 +1,7 @@ {{ $authorName:= "John Doe"}} +{{ if .Site.Data.site.author}} + {{ $authorName = .Site.Data.site.author.name }} +{{ end}} {{ if eq (printf "%T" .Params.author ) "maps.Params" }} {{ with .Params.author }} {{ if .name }}