Add email, url author attributes

master
Will Faught 2 years ago
parent fcb373dd79
commit 91e6ea9575

@ -291,8 +291,10 @@ Optional site parameters:
```toml ```toml
[authors.will-faught] [authors.will-faught]
name = "Will Faught"
default = false # Credit this author in pages that have no authors parameter default = false # Credit this author in pages that have no authors parameter
email = "will.faught@example.com"
name = "Will Faught"
url = "https://willfaught.com/paige"
``` ```
Optional page parameters: Optional page parameters:
@ -304,8 +306,10 @@ link = "https://youtu.be/dQw4w9WgXcQ" # The reference for an anchor around the t
[[authors]] [[authors]]
author = "will-faught" # Credit the corresponding author in the site parameters author = "will-faught" # Credit the corresponding author in the site parameters
[[authors]] [[authors]] # Credit this author
name = "Will Faught" # Credit this author email = "will.faught@example.com"
name = "Will Faught"
url = "https://willfaught.com/paige"
[paige] [paige]
alert = "Alert!" # Markdown displayed before the page body (defaults to primary alert type) alert = "Alert!" # Markdown displayed before the page body (defaults to primary alert type)

@ -87,8 +87,10 @@ path = "github.com/willfaught/paige"
home = ["html", "json", "rss"] home = ["html", "json", "rss"]
[params.authors.will-faught] [params.authors.will-faught]
name = "Will Faught"
default = true default = true
email = "will.faught@example.com"
name = "Will Faught"
url = "https://willfaught.com/paige"
[params.paige.git] [params.paige.git]
commit_url = "https://github.com/willfaught/paige/commit/%s" commit_url = "https://github.com/willfaught/paige/commit/%s"

@ -4,27 +4,37 @@
{{ if $page.Params.authors }} {{ if $page.Params.authors }}
{{ range $page.Params.authors }} {{ range $page.Params.authors }}
{{ $email := "" }}
{{ $id := "" }} {{ $id := "" }}
{{ $name := "" }} {{ $name := "" }}
{{ $url := "" }}
{{ if reflect.IsMap . }} {{ if reflect.IsMap . }}
{{ with .author }} {{ with .author }}
{{ $id = . }} {{ $id = . }}
{{ $name = (index site.Params.authors .).name }} {{ $author := index site.Params.authors $id }}
{{ $email = $author.email }}
{{ $name = $author.name }}
{{ $url = $author.url }}
{{ else }} {{ else }}
{{ $email = .email }}
{{ $name = .name }} {{ $name = .name }}
{{ $url = .url }}
{{ end }} {{ end }}
{{ else }} {{ else }}
{{ $id = . }} {{ $id = . }}
{{ $name = (index site.Params.authors .).name }} {{ $author := index site.Params.authors $id }}
{{ $email = $author.email }}
{{ $name = $author.name }}
{{ $url = $author.url }}
{{ end }} {{ end }}
{{ $result = $result | append (dict "id" $id "name" $name) }} {{ $result = $result | append (dict "email" $email "id" $id "name" $name "url" $url) }}
{{ end }} {{ end }}
{{ else if site.Params.authors }} {{ else if site.Params.authors }}
{{ range $k, $v := site.Params.authors }} {{ range $k, $v := site.Params.authors }}
{{ if eq $v.default true }} {{ if eq $v.default true }}
{{ $result = $result | append (dict "id" $k "name" $v.name) }} {{ $result = $result | append (dict "email" $v.email "id" $k "name" $v.name "url" $v.url) }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }} {{ end }}

Loading…
Cancel
Save