Convert authors to taxonomies
This commit is contained in:
@@ -164,15 +164,15 @@
|
||||
{{ with partial "paige/authors.html" . }}
|
||||
{{ range . }}
|
||||
<author>
|
||||
{{ with .email }}
|
||||
{{ with .Params.email }}
|
||||
<email>{{ . }}</email>
|
||||
{{ end }}
|
||||
|
||||
{{ with .name }}
|
||||
{{ with .Params.Title }}
|
||||
<name>{{ . }}</name>
|
||||
{{ end }}
|
||||
|
||||
{{ with .url }}
|
||||
{{ with .Params.url }}
|
||||
<uri>{{ . }}</uri>
|
||||
{{ end }}
|
||||
</author>
|
||||
|
@@ -85,10 +85,10 @@
|
||||
{{ with $authors }}
|
||||
{{ $primary := index . 0 }}
|
||||
|
||||
{{ if and $primary.name $primary.email }}
|
||||
{{ $author = printf "%s (%s)" $primary.email $primary.name }}
|
||||
{{ else if $primary.email }}
|
||||
{{ $author = $primary.email }}
|
||||
{{ if and $primary.Params.email $primary.Title }}
|
||||
{{ $author = printf "%s (%s)" $primary.Params.email $primary.Title }}
|
||||
{{ else if $primary.Params.email }}
|
||||
{{ $author = $primary.Params.email }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
|
@@ -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 }}
|
||||
|
@@ -52,15 +52,7 @@
|
||||
{{ range $i, $author := . -}}
|
||||
{{- if gt $i 0 }}, {{ end -}}
|
||||
|
||||
{{- with $author.id -}}
|
||||
{{- with site.GetPage (print "authors/" .) -}}
|
||||
<a class="link-secondary" href="{{ .RelPermalink }}">{{ .Title | default $author.name }}</a>
|
||||
{{- else -}}
|
||||
{{- $author.name -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- $author.name -}}
|
||||
{{- end -}}
|
||||
<a class="link-secondary" href="{{ .RelPermalink }}">{{ .Title }}</a>
|
||||
{{- end }}
|
||||
</p>
|
||||
{{ end }}
|
||||
|
@@ -6,7 +6,7 @@
|
||||
{{ $authors := slice }}
|
||||
|
||||
{{ range . }}
|
||||
{{ $authors = $authors | append .name }}
|
||||
{{ $authors = $authors | append .Title }}
|
||||
{{ end }}
|
||||
|
||||
<meta content="{{ delimit $authors `, ` }}" name="author">
|
||||
|
@@ -84,15 +84,7 @@
|
||||
{{ range $i, $author := . -}}
|
||||
{{- if gt $i 0 }}, {{ end -}}
|
||||
|
||||
{{- with $author.id -}}
|
||||
{{- with site.GetPage (print "authors/" .) -}}
|
||||
<a class="link-secondary" href="{{ .RelPermalink }}">{{ .Title | default $author.name }}</a>
|
||||
{{- else -}}
|
||||
{{- $author.name -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- $author.name -}}
|
||||
{{- end -}}
|
||||
<a class="link-secondary" href="{{ .RelPermalink }}">{{ .Title }}</a>
|
||||
{{- end }}
|
||||
</p>
|
||||
{{ end }}
|
||||
|
Reference in New Issue
Block a user