- {{/* Only show About widget if a profile has been configured for this user. */}}
- {{ $widget := "widgets/about.html" }}
- {{ $params := dict "root" $ "page" . "author" .Title }}
- {{ with site.GetPage (printf "/author/%s" (urlize .Title)) }}
+ {{/* Show the About widget if an account exists for this user. */}}
+ {{ if .File }}
+ {{ $widget := "widgets/about.html" }}
+ {{ $slug := delimit (last 1 (split (trim .File.Dir "/") "/")) "" }}{{/* Alternatively, use `index .Params.authors 0` */}}
+ {{ $params := dict "root" $ "page" . "author" $slug }}
{{ partial $widget $params }}
- {{ end }}
+ {{end}}
{{ $query := where .Pages ".IsNode" false }}
{{ $count := len $query }}
@@ -35,6 +38,5 @@
{{ end }}
-
{{ partial "footer_container.html" . }}
{{ partial "footer.html" . }}
diff --git a/layouts/author/terms.html b/layouts/authors/terms.html
similarity index 53%
rename from layouts/author/terms.html
rename to layouts/authors/terms.html
index 6d9add9d..42dc07b1 100644
--- a/layouts/author/terms.html
+++ b/layouts/authors/terms.html
@@ -1,3 +1,5 @@
+{{/* List of all authors. */}}
+
{{ partial "header.html" . }}
{{ partial "navbar.html" . }}
@@ -11,16 +13,8 @@
{{ $paginator := .Paginate .Data.Pages }}
{{ range $k, $v := $paginator.Pages }}
- {{ $person_page_path := (printf "/author/%s" (urlize $v.Title)) }}
- {{ $person_page := site.GetPage $person_page_path }}
- {{ $name := "" }}
- {{ if $person_page }}
- {{ $person := $person_page.Params }}
- {{ $name = $person.name }}
- {{ else }}
- {{ $name = $v.Title | plainify }}
- {{ end }}
- - {{ $name }}
+ {{ $name := $v.Params.name | default ($v.Title|plainify) }}
+ - {{$name}}
{{ end }}
diff --git a/layouts/index.json b/layouts/index.json
index a97f11f2..4854ae48 100644
--- a/layouts/index.json
+++ b/layouts/index.json
@@ -3,8 +3,8 @@
{{- $pages := site.RegularPages -}}
{{- /* Add the index page of docs separately since it's not in RegularPages above. */ -}}
{{- $pages := $pages | union (where (where site.Pages "Kind" "section") "Type" "docs") -}}
-{{- /* Add author pages to index so their bios can be searched. Hide empty `/author/` node. */ -}}
-{{- $pages := $pages | union (where (where site.Pages "Section" "author") "Params.name" "!=" nil) -}}
+{{- /* Add author pages to index so their bios can be searched. Hide empty `/authors/` node. */ -}}
+{{- $pages := $pages | union (where (where site.Pages "Section" "authors") "Params.name" "!=" nil) -}}
{{- range $pages -}}
{{- /* Do not index drafts or private pages. */ -}}
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index 1d91cfe0..040493f9 100644
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -13,7 +13,7 @@
{{ $superuser_name := "" }}
{{ $superuser_username := "" }}
{{ $superuser_role := "" }}
- {{ range first 1 (where (where site.Pages "Section" "author") "Params.superuser" true) }}
+ {{ range first 1 (where (where site.Pages "Section" "authors") "Params.superuser" true) }}
{{ $superuser_name = .Params.name }}
{{ $superuser_username = delimit (last 1 (split (substr .File.Dir 0 -1) "/")) "" }}
{{ $superuser_role = .Params.role }}
diff --git a/layouts/partials/page_author.html b/layouts/partials/page_author.html
index f2e0df90..bdb9c8da 100644
--- a/layouts/partials/page_author.html
+++ b/layouts/partials/page_author.html
@@ -1,59 +1,60 @@
+{{/* Author profile box */}}
+
{{ if not (or (eq site.Params.profile false) (eq .Params.profile false)) }}
{{/* Display superuser if superuser exists and page authors are not explicitly specified. */}}
{{/* Otherwise, display first author if a profile for them exists. */}}
-{{ $author_urlize := "" }}
+{{ $author_urlized := "" }}
{{ if and (not .Params.authors) (.Scratch.Get "superuser_username") }}
- {{ $author_urlize = (.Scratch.Get "superuser_username") }}
+ {{ $author_urlized = (.Scratch.Get "superuser_username") }}
{{ else }}
{{ $first_author := "" }}
{{ if .Params.authors }}
{{ $first_author = index .Params.authors 0 }}
{{ end }}
- {{ $author_urlize = urlize $first_author }}
+ {{ $author_urlized = urlize $first_author }}
{{ end }}
-{{ $person_page_path := (printf "/author/%s" $author_urlize) }}
-{{ $person_page := site.GetPage $person_page_path }}
-{{ with $person_page }}
-{{ $link := printf "/authors/%s" $author_urlize | relURL }}
-{{ $avatar := ($person_page.Resources.ByType "image").GetMatch "*avatar*" }}
-