Add multiple authors

master
Will Faught 3 years ago
parent 69b5fd8a1b
commit 4d84560390

@ -50,6 +50,7 @@ Search page:
- Math typesetting - Math typesetting
- Menu - Menu
- Minimal design - Minimal design
- Multiple authors
- Multiple languages - Multiple languages
- RSS with full content - RSS with full content
- Responsive - Responsive
@ -174,6 +175,12 @@ $ hugo server -D
Optional site parameters: Optional site parameters:
```yaml ```yaml
authors:
michael_bluth:
name: Michael Bluth
default: true # Credit this author in pages that have no authors parameter
george_bluth:
name: George Bluth
paige: paige:
analytics: analytics:
chartbeat: # chartbeat.com chartbeat: # chartbeat.com
@ -231,6 +238,10 @@ If you set either `hide_theme_comment` or `hide_theme_link`, please credit this
Optional page parameters: Optional page parameters:
```yaml ```yaml
authors: [
"Michael Bluth", # Credit this name exactly
"george_bluth" # Credit the corresponding author name in the site parameters
]
link: "https://youtu.be/dQw4w9WgXcQ" # The reference for an anchor around the title link: "https://youtu.be/dQw4w9WgXcQ" # The reference for an anchor around the title
paige: paige:
math: true # Enable math typesetting with KaTeX math: true # Enable math typesetting with KaTeX

@ -1,6 +1,3 @@
author:
email: example@example.com
name: Michael Bluth
baseurl: https://example.com baseurl: https://example.com
copyright: © Michael Bluth copyright: © Michael Bluth
enablerobotstxt: true enablerobotstxt: true

@ -2,7 +2,7 @@
<article> <article>
{{ partial "paige-title.html" . }} {{ partial "paige-title.html" . }}
{{ partial "paige-description.html" . }} {{ partial "paige-description.html" . }}
{{ partial "paige-date.html" . }} {{ partial "paige-metadata.html" . }}
{{ with .Params.stretch }} {{ with .Params.stretch }}
<div class="mb-3 mw-100 rounded-4 shadow" style="background-image: url('{{ relLangURL . }}'); background-position: center; background-size: cover; height: 20rem"></div> <div class="mb-3 mw-100 rounded-4 shadow" style="background-image: url('{{ relLangURL . }}'); background-position: center; background-size: cover; height: 20rem"></div>
{{ end }} {{ end }}

@ -42,7 +42,7 @@
{{ end }} {{ end }}
{{ range $pages }} {{ range $pages }}
<item> <item>
{{ with .Site.Author.email }} {{ with partial "paige-authors.html" . }}
<author>{{ . }}</author> <author>{{ . }}</author>
{{ end }} {{ end }}
{{ if .Content }} {{ if .Content }}
@ -58,7 +58,7 @@
<pubDate>{{ .Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> <pubDate>{{ .Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{ end }} {{ end }}
{{ with .Title }} {{ with .Title }}
<title>{{ . }}</title> <title>{{ . | markdownify | plainify | htmlUnescape }}</title>
{{ end }} {{ end }}
</item> </item>
{{ end }} {{ end }}

@ -1,6 +1,6 @@
<article> <article>
{{ partial "paige-title.html" . }} {{ partial "paige-title.html" . }}
{{ partial "paige-description.html" . }} {{ partial "paige-description.html" . }}
{{ partial "paige-date.html" . }} {{ partial "paige-metadata.html" . }}
{{ partial "paige-content.html" . }} {{ partial "paige-content.html" . }}
</article> </article>

@ -0,0 +1,17 @@
{{ $result := "" }}
{{ if .Params.authors }}
{{ $names := slice }}
{{ range .Params.authors }}
{{ $names = $names | append (index site.Params.authors . "name" | default .) }}
{{ end }}
{{ $result = delimit $names ", " }}
{{ else if .Site.Params.authors }}
{{ $names := slice }}
{{ range $k, $v := .Site.Params.authors }}
{{ if eq $v.default true }}
{{ $names = $names | append $v.name }}
{{ end }}
{{ end }}
{{ $result = delimit $names ", " }}
{{ end }}
{{ return $result }}

@ -1,7 +0,0 @@
{{ with .PublishDate }}
{{ $format := ":date_long" }}
{{ with site.Params.paige.date_format }}
{{ $format = . }}
{{ end }}
<p class="text-center text-muted"><time datetime="{{ .Format `2006-01-02` }}">{{ time.Format $format . }}</time></p>
{{ end }}

@ -0,0 +1,8 @@
{{ $authors := partial "paige-authors.html" . }}
{{ if or $authors .PublishDate}}
<p class="text-center text-muted">
{{- with $authors }}{{ . }}{{ end -}}
{{- if and $authors .PublishDate }}<br>{{ end -}}
{{- with .PublishDate }}<time datetime="{{ .Format `2006-01-02` }}">{{ time.Format (site.Params.paige.date_format | default ":date_long") . }}</time>{{ end -}}
</p>
{{ end }}
Loading…
Cancel
Save