Convert authors to taxonomies
This commit is contained in:
@@ -1,40 +1,11 @@
|
||||
{{ $page := . }}
|
||||
|
||||
{{ $result := slice }}
|
||||
{{ $result := $page.GetTerms "authors" }}
|
||||
|
||||
{{ if $page.Params.authors }}
|
||||
{{ range $page.Params.authors }}
|
||||
{{ $email := "" }}
|
||||
{{ $id := "" }}
|
||||
{{ $name := "" }}
|
||||
{{ $url := "" }}
|
||||
|
||||
{{ if reflect.IsMap . }}
|
||||
{{ with .author }}
|
||||
{{ $id = . }}
|
||||
{{ $author := index site.Params.authors $id }}
|
||||
{{ $email = $author.email }}
|
||||
{{ $name = $author.name }}
|
||||
{{ $url = $author.url }}
|
||||
{{ else }}
|
||||
{{ $email = .email }}
|
||||
{{ $name = .name }}
|
||||
{{ $url = .url }}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ $id = . }}
|
||||
{{ $author := index site.Params.authors $id }}
|
||||
{{ $email = $author.email }}
|
||||
{{ $name = $author.name }}
|
||||
{{ $url = $author.url }}
|
||||
{{ end }}
|
||||
|
||||
{{ $result = $result | append (dict "email" $email "id" $id "name" $name "url" $url) }}
|
||||
{{ end }}
|
||||
{{ else if site.Params.authors }}
|
||||
{{ range $k, $v := site.Params.authors }}
|
||||
{{ if eq $v.default true }}
|
||||
{{ $result = $result | append (dict "email" $v.email "id" $k "name" $v.name "url" $v.url) }}
|
||||
{{ if and $page.IsPage (not $result) site.Taxonomies.authors }}
|
||||
{{ range $id, $taxonomy := site.Taxonomies.authors }}
|
||||
{{ if eq $taxonomy.Page.Params.default true }}
|
||||
{{ $result = $result | append $taxonomy.Page }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
Reference in New Issue
Block a user