Use a new authors array instead of a string

This commit is contained in:
BBaoVanC 2021-10-27 19:39:25 -05:00
parent 7ffa6c068c
commit fe4d0979d6
Signed by: bbaovanc
GPG Key ID: 18089E4E3CCF1D3A
3 changed files with 16 additions and 2 deletions

View File

@ -2,11 +2,13 @@
title: {{ replace .Name "-" " " | title }} title: {{ replace .Name "-" " " | title }}
date: {{ .Date | time.Format "2006-01-02" }} date: {{ .Date | time.Format "2006-01-02" }}
author: {{ with .Site.Author.name }}{{ . }}{{ else }}John Doe{{ end }}
toc: true toc: true
comments: true comments: true
draft: true draft: true
authors:
- {{ with .Site.Author.name }}{{ . }}{{ else }}John Doe{{ end }}
tags: tags:
- awesome - awesome

View File

@ -1,11 +1,13 @@
--- ---
title: {{ replace .Name "-" " " | title }} title: {{ replace .Name "-" " " | title }}
author: {{ with .Site.Author.name }}{{ . }}{{ else }}John Doe{{ end }}
menu: main menu: main
toc: true toc: true
comments: false comments: false
authors:
- {{ with .Site.Author.name }}{{ . }}{{ else }}John Doe{{ end }}
--- ---
This page is about something. All the content before the "more" HTML comment This page is about something. All the content before the "more" HTML comment

View File

@ -20,7 +20,17 @@
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ $authorString := "" }}
{{ with .Params.authors }}
{{ $authorString = delimit . ", " }}
{{ else }}
{{ with .Params.author }} {{ with .Params.author }}
{{ $authorString = . }}
{{ end }}
{{ end }}
{{ with $authorString }}
<span class="post-meta-item"> <span class="post-meta-item">
{{ partial "icon.html" "user-circle" }} {{ partial "icon.html" "user-circle" }}
{{ . }} {{ . }}