diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index 277aeeb7..0118496b 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -26,22 +26,26 @@ languages: name: "Customization" url: "/customization/" weight: 50 + - identifier: "authors" + name: "Authors" + url: "/authors/" + weight: 60 - identifier: "series" name: "Series" url: "/series/" - weight: 60 + weight: 70 - identifier: "categories" name: "Categories" url: "/categories/" - weight: 70 + weight: 80 - identifier: "tags" name: "Tags" url: "/tags/" - weight: 80 + weight: 90 - identifier: "search" name: "Search" url: "/search/" - weight: 90 + weight: 100 weight: 10 markup: goldmark: @@ -67,6 +71,7 @@ params: git: commit_url_prefix: "https://github.com/willfaught/paige/commit/" taxonomies: + author: "authors" category: "categories" series: "series" tag: "tags" diff --git a/exampleSite/content/authors/will-faught/_index.md b/exampleSite/content/authors/will-faught/_index.md new file mode 100644 index 00000000..41345593 --- /dev/null +++ b/exampleSite/content/authors/will-faught/_index.md @@ -0,0 +1,4 @@ +--- +description: "Demonstration of an author." +title: "Will Faught" +--- diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index 76b67fa3..64b4fe66 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -46,7 +46,13 @@ {{ range $pages }} {{ with partial "paige/authors.html" . }} - {{ . }} + {{ $authors := slice }} + + {{ range . }} + {{ $authors = $authors | append .name }} + {{ end }} + + {{ delimit $authors ", " }} {{ end }} {{ if .Content }} {{ printf "" .Content | safeHTML }} diff --git a/layouts/partials/paige/authors.html b/layouts/partials/paige/authors.html index c69e4d94..100f2f88 100644 --- a/layouts/partials/paige/authors.html +++ b/layouts/partials/paige/authors.html @@ -1,33 +1,32 @@ {{ $page := . }} -{{ $result := "" }} +{{ $result := slice }} {{ if $page.Params.authors }} - {{ $names := slice }} - {{ range $page.Params.authors }} - {{ if eq (printf "%T" .) "string" }} - {{ $names = $names | append (index site.Params.authors .).name }} - {{ else }} + {{ $id := "" }} + {{ $name := "" }} + + {{ if reflect.IsMap . }} {{ with .author }} - {{ $names = $names | append (index site.Params.authors .).name }} + {{ $id = . }} + {{ $name = (index site.Params.authors .).name }} {{ else }} - {{ $names = $names | append .name }} + {{ $name = .name }} {{ end }} + {{ else }} + {{ $id = . }} + {{ $name = (index site.Params.authors .).name }} {{ end }} - {{ end }} - {{ $result = delimit $names ", " }} + {{ $result = $result | append (dict "id" $id "name" $name) }} + {{ end }} {{ else if site.Params.authors }} - {{ $names := slice }} - {{ range $k, $v := site.Params.authors }} {{ if eq $v.default true }} - {{ $names = $names | append $v.name }} + {{ $result = $result | append (dict "id" $k "name" $v.name) }} {{ end }} {{ end }} - - {{ $result = delimit $names ", " }} {{ end }} {{ return $result }} diff --git a/layouts/partials/paige/metadata.html b/layouts/partials/paige/metadata.html index ed82f223..08c6e2b2 100644 --- a/layouts/partials/paige/metadata.html +++ b/layouts/partials/paige/metadata.html @@ -72,7 +72,21 @@ {{ end }} {{ with $authors }} -

{{ . }}

+

+ {{ range $i, $author := . -}} + {{- if gt $i 0 }}, {{ end -}} + + {{- with $author.id -}} + {{- with site.GetPage (print "authors/" .) -}} + {{ .Title | default $author.name }} + {{- else -}} + {{- $author.name -}} + {{- end -}} + {{- else -}} + {{- $author.name -}} + {{- end -}} + {{- end }} +

{{ end }} {{ with $date }} diff --git a/layouts/partials/paige/page.html b/layouts/partials/paige/page.html index dcdab4f3..b7a40b94 100644 --- a/layouts/partials/paige/page.html +++ b/layouts/partials/paige/page.html @@ -90,7 +90,21 @@ {{ end }} {{ with $authors }} -

{{ . }}

+

+ {{ range $i, $author := . -}} + {{- if gt $i 0 }}, {{ end -}} + + {{- with $author.id -}} + {{- with site.GetPage (print "authors/" .) -}} + {{ .Title | default $author.name }} + {{- else -}} + {{- $author.name -}} + {{- end -}} + {{- else -}} + {{- $author.name -}} + {{- end -}} + {{- end }} +

{{ end }} {{ with $date }}