From fe4d0979d68aebf75d15f67f02ab94210ca7c321 Mon Sep 17 00:00:00 2001 From: BBaoVanC Date: Wed, 27 Oct 2021 19:39:25 -0500 Subject: [PATCH] Use a new authors array instead of a string --- archetypes/blog/index.md | 4 +++- archetypes/default/index.md | 4 +++- layouts/partials/post-metadata.html | 10 ++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/archetypes/blog/index.md b/archetypes/blog/index.md index 2a2c56e..eadc0d4 100644 --- a/archetypes/blog/index.md +++ b/archetypes/blog/index.md @@ -2,11 +2,13 @@ title: {{ replace .Name "-" " " | title }} date: {{ .Date | time.Format "2006-01-02" }} -author: {{ with .Site.Author.name }}{{ . }}{{ else }}John Doe{{ end }} toc: true comments: true draft: true +authors: + - {{ with .Site.Author.name }}{{ . }}{{ else }}John Doe{{ end }} + tags: - awesome diff --git a/archetypes/default/index.md b/archetypes/default/index.md index 1de9acb..eb3d4a4 100644 --- a/archetypes/default/index.md +++ b/archetypes/default/index.md @@ -1,11 +1,13 @@ --- title: {{ replace .Name "-" " " | title }} -author: {{ with .Site.Author.name }}{{ . }}{{ else }}John Doe{{ end }} menu: main toc: true comments: false +authors: + - {{ with .Site.Author.name }}{{ . }}{{ else }}John Doe{{ end }} + --- This page is about something. All the content before the "more" HTML comment diff --git a/layouts/partials/post-metadata.html b/layouts/partials/post-metadata.html index 6a5629e..d6e98cf 100644 --- a/layouts/partials/post-metadata.html +++ b/layouts/partials/post-metadata.html @@ -20,7 +20,17 @@ {{ end }} {{ end }} + {{ $authorString := "" }} + + {{ with .Params.authors }} + {{ $authorString = delimit . ", " }} + {{ else }} {{ with .Params.author }} + {{ $authorString = . }} + {{ end }} + {{ end }} + + {{ with $authorString }} {{ partial "icon.html" "user-circle" }} {{ . }}