diff --git a/exampleSite/config/_default/config.toml b/exampleSite/config/_default/config.toml index 0162a0d5..ba89b491 100644 --- a/exampleSite/config/_default/config.toml +++ b/exampleSite/config/_default/config.toml @@ -37,6 +37,13 @@ enableEmoji = true footnotereturnlinkcontents = "^" ignoreFiles = ["\\.ipynb$", ".ipynb_checkpoints$", "\\.Rmd$", "\\.Rmarkdown$", "_files$", "_cache$"] +# Workaround Hugo publishing taxonomy URLs as plurals - consistently use singular across Academic. +[permalinks] + authors = "/author/:slug/" + tags = "/tag/:slug/" + categories = "/category/:slug/" + publication_types = "/publication-type/:slug/" + [outputs] home = [ "HTML", "RSS", "JSON", "WebAppManifest" ] section = [ "HTML", "RSS" ] diff --git a/exampleSite/content/authors/admin/_index.md b/exampleSite/content/authors/admin/_index.md index 23eff309..9b754e03 100644 --- a/exampleSite/content/authors/admin/_index.md +++ b/exampleSite/content/authors/admin/_index.md @@ -1,6 +1,6 @@ --- # Display name -name: Nelson Bighetti +title: Nelson Bighetti # Username (this should match the folder name) authors: diff --git a/layouts/authors/terms.html b/layouts/authors/terms.html index bf88ba98..bd6350ea 100644 --- a/layouts/authors/terms.html +++ b/layouts/authors/terms.html @@ -12,7 +12,7 @@ diff --git a/layouts/index.json b/layouts/index.json index 4e9f95d7..e3de4de3 100644 --- a/layouts/index.json +++ b/layouts/index.json @@ -4,7 +4,7 @@ {{- /* 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 `/authors/` node. */ -}} -{{- $pages := $pages | union (where (where site.Pages "Section" "authors") "Params.name" "!=" nil) -}} +{{- $pages := $pages | union (where (where site.Pages "Section" "authors") "Params.superuser" "!=" nil) -}} {{- range $pages -}} {{- /* Do not index drafts or private pages. */ -}} @@ -27,7 +27,6 @@ {{/* Correct the title and URL for author profile pages. */}} {{- if eq .Section "authors" -}} - {{- $title = .Params.name -}} {{- $username := path.Base (path.Split .Path).Dir -}} {{- with site.GetPage (printf "/authors/%s" $username) -}} {{- $permalink = .Permalink -}} @@ -43,8 +42,7 @@ {{- $person_page_path := (printf "/authors/%s" (urlize $v)) -}} {{- $person_page := site.GetPage $person_page_path -}} {{- if and $person_page $person_page.File -}} - {{- $person := $person_page.Params -}} - {{- $authors = $authors | append $person.name -}} + {{- $authors = $authors | append $person_page.Title -}} {{- else -}} {{- $authors = $authors | append ($v | plainify) -}} {{- end -}} diff --git a/layouts/partials/functions/get_author_name.html b/layouts/partials/functions/get_author_name.html index 2c4b4896..5f90d5c8 100644 --- a/layouts/partials/functions/get_author_name.html +++ b/layouts/partials/functions/get_author_name.html @@ -18,7 +18,7 @@ {{ $taxonomy := "authors" }} {{ $profile_page := site.GetPage (printf "/%s/%s" $taxonomy $author_username) }} {{ with $profile_page }} - {{ $author = .Params.name | default .Title }} + {{ $author = .Title }} {{ else }} {{ $author = $author | default $publisher }} {{ end }} diff --git a/layouts/partials/page_author_card.html b/layouts/partials/page_author_card.html index 29538979..dffdc5d2 100644 --- a/layouts/partials/page_author_card.html +++ b/layouts/partials/page_author_card.html @@ -4,26 +4,28 @@ {{ $taxonomy := "authors" }} {{ $profile_page := site.GetPage (printf "/%s/%s" $taxonomy $author_urlized) }} {{ with $profile_page }} - {{/* If it's a personal site and primary page author is superuser, link to the homepage rather than their profile page. */}} - {{ $profile_url := .RelPermalink }} - {{ if and (eq $site_type "Person") (eq .Params.superuser true) }} - {{ $profile_url = site.BaseURL }} - {{ end }} - {{ $avatar := (.Resources.ByType "image").GetMatch "*avatar*" }} - {{ $avatar_shape := site.Params.avatar.shape | default "circle" }} -
- {{ if and site.Params.avatar.gravatar .Params.email }} - {{.Params.name}} - {{ else if $avatar }} - {{ $avatar_image := $avatar.Fill "270x270 Center" }} - {{.Params.name}} + {{ if isset .Params "superuser" }}{{/* Check an author profile exists. */}} + {{/* If it's a personal site and primary page author is superuser, link to the homepage rather than their profile page. */}} + {{ $profile_url := .RelPermalink }} + {{ if and (eq $site_type "Person") (eq .Params.superuser true) }} + {{ $profile_url = site.BaseURL }} {{ end }} + {{ $avatar := (.Resources.ByType "image").GetMatch "*avatar*" }} + {{ $avatar_shape := site.Params.avatar.shape | default "circle" }} +
+ {{ if and site.Params.avatar.gravatar .Params.email }} + {{.Title}} + {{ else if $avatar }} + {{ $avatar_image := $avatar.Fill "270x270 Center" }} + {{.Title}} + {{ end }} -
-
{{.Params.name}}
- {{ with .Params.role }}
{{. | markdownify | emojify}}
{{end}} - {{ with .Params.bio }}

{{. | markdownify | emojify}}

{{end}} - {{ partial "social_links" . }} +
+
{{.Title}}
+ {{ with .Params.role }}
{{. | markdownify | emojify}}
{{end}} + {{ with .Params.bio }}

{{. | markdownify | emojify}}

{{end}} + {{ partial "social_links" . }} +
-
+ {{end}} {{end}}{{/* Profile page block */}} diff --git a/layouts/partials/page_metadata_authors.html b/layouts/partials/page_metadata_authors.html index ef685d5a..2d7a48b3 100644 --- a/layouts/partials/page_metadata_authors.html +++ b/layouts/partials/page_metadata_authors.html @@ -5,7 +5,7 @@ {{ $link_authors := site.Params.link_authors | default true }} {{ range $index, $value := . }} {{- $profile_page := site.GetPage (printf "/%s/%s" $taxonomy (. | urlize)) -}} - {{- $name := $profile_page.Params.name | default ($value|markdownify) -}} + {{- $name := $profile_page.Title | default ($value|markdownify) -}} {{- if gt $index 0 }}, {{ end -}} {{- if and $profile_page $link_authors -}} diff --git a/layouts/partials/site_head.html b/layouts/partials/site_head.html index dc3d2c35..3de927fc 100644 --- a/layouts/partials/site_head.html +++ b/layouts/partials/site_head.html @@ -12,7 +12,7 @@ {{ $superuser_username := "" }} {{ $superuser_role := "" }} {{ range first 1 (where (where site.Pages "Section" "authors") "Params.superuser" true) }} - {{ $superuser_name = .Params.name }} + {{ $superuser_name = .Title }} {{ $superuser_username = path.Base (path.Split .Path).Dir }} {{ $superuser_role = .Params.role }} {{ end }} @@ -182,7 +182,7 @@ {{ end }} - + {{- with $og_image -}} @@ -206,6 +206,6 @@ {{ partial "custom_head" . }} - {{ if not .IsHome }}{{ .Params.name | default .Title }} | {{ end }}{{ site.Title }} + {{ if not .IsHome }}{{ .Title }} | {{ end }}{{ site.Title }} diff --git a/layouts/partials/widgets/about.html b/layouts/partials/widgets/about.html index 5a8df2a6..8f944255 100644 --- a/layouts/partials/widgets/about.html +++ b/layouts/partials/widgets/about.html @@ -23,14 +23,14 @@
{{ if site.Params.avatar.gravatar }} - {{$person.name}} + {{$person_page.Title}} {{ else if $avatar }} {{ $avatar_image := $avatar.Fill "270x270 Center" }} - {{$person.name}} + {{$person_page.Title}} {{ end }}
-

{{ $person.name }}

+

{{ $person_page.Title }}

{{ with $person.role }}

{{ . | markdownify | emojify }}

{{ end }} {{ range $person.organizations }} diff --git a/layouts/partials/widgets/people.html b/layouts/partials/widgets/people.html index 53760038..051f4bcb 100644 --- a/layouts/partials/widgets/people.html +++ b/layouts/partials/widgets/people.html @@ -50,7 +50,7 @@ {{ end }}
-

{{with $link}}{{end}}{{ .Params.name }}{{if $link}}{{end}}

+

{{with $link}}{{end}}{{ .Title }}{{if $link}}{{end}}

{{ with .Params.role }}

{{ . | markdownify | emojify }}

{{ end }} {{ if $show_social }}{{ partial "social_links" . }}{{ end }} {{ if and $show_interests .Params.interests }}

{{ delimit .Params.interests ", " | markdownify | emojify }}

{{ end }} diff --git a/layouts/shortcodes/mention.html b/layouts/shortcodes/mention.html index 3eb5e02b..7347faa7 100644 --- a/layouts/shortcodes/mention.html +++ b/layouts/shortcodes/mention.html @@ -2,7 +2,7 @@ {{- $username_url := $username | urlize -}} {{- $taxonomy := "authors" -}} {{- $profile_page := site.GetPage (printf "/%s/%s" $taxonomy $username_url) -}} -{{- $name := $profile_page.Params.name | default ($username|markdownify) -}} +{{- $name := $profile_page.Title | default ($username|markdownify) -}} {{- with $profile_page -}} {{$name}} {{- else -}}