forked from Vimux/Mainroad
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This supports multiple authors, and avoids using the now-deprecated [Author] block in Hugo.toml Fixes Issue Vimux#382
- Loading branch information
Showing
2 changed files
with
46 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,35 @@ | ||
{{- if .Param "authorbox" }} | ||
<div class="authorbox clearfix"> | ||
{{- if and (not .Site.Author.avatar) (not .Site.Author.name) (not .Site.Author.bio) }} | ||
<p class="authorbox__warning"> | ||
<strong>WARNING:</strong> Authorbox is activated, but [Author] parameters are not specified. | ||
</p> | ||
{{- end }} | ||
{{- with .Site.Author.avatar }} | ||
<figure class="authorbox__avatar"> | ||
<img alt="{{ $.Site.Author.name }} avatar" src="{{ $.Site.Author.avatar | relURL }}" class="avatar" height="90" width="90"> | ||
</figure> | ||
{{- end }} | ||
{{- with .Site.Author.name }} | ||
<div class="authorbox__header"> | ||
<span class="authorbox__name">{{ T "authorbox_name" (dict "Name" .) }}</span> | ||
</div> | ||
{{- end }} | ||
{{- with .Site.Author.bio }} | ||
<div class="authorbox__description"> | ||
{{ . | markdownify }} | ||
</div> | ||
{{ $author := default .Site.Author (index .Site.Data.authors (.Params.author | default "default")) }} | ||
{{- with $author }} | ||
{{- if (not $author.avatar) }} | ||
<p class="authorbox__warning"> | ||
<strong>WARNING:</strong> Authorbox is activated, but author is missing the "avatar" property. | ||
</p> | ||
{{- end }} | ||
{{- if (not $author.name) }} | ||
<p class="authorbox__warning"> | ||
<strong>WARNING:</strong> Authorbox is activated, but author is missing the "name" property. | ||
if (not $author.bio) }} | ||
<p class="authorbox__warning"> | ||
<strong>WARNING:</strong> Authorbox is activated, but author is missing the "bio" property. | ||
</p> | ||
{{- end }} | ||
{{- with $author.avatar }} | ||
<figure class="authorbox__avatar"> | ||
<img alt="{{ $author.name }} avatar" src="{{ $author.avatar | relURL }}" class="avatar" height="90" width="90"> | ||
</figure> | ||
{{- end }} | ||
{{- with $author.name }} | ||
<div class="authorbox__header"> | ||
<span class="authorbox__name">{{ T "authorbox_name" (dict "Name" .) }}</span> | ||
</div> | ||
{{- end }} | ||
{{- with $author.bio }} | ||
<div class="authorbox__description"> | ||
{{ . | markdownify }} | ||
</div> | ||
{{- end }} | ||
{{- end }} | ||
</div> | ||
{{- end }} |