diff --git a/content/author/ronald-visser/_index.md b/content/author/ronald-visser/_index.md index 15a8d69f8f..e79954b7e4 100644 --- a/content/author/ronald-visser/_index.md +++ b/content/author/ronald-visser/_index.md @@ -1,7 +1,7 @@ --- name: Ronald M. Visser mastodon: https://akademienl.social/@RonaldVisser -bio: Interdisicplinary scientist combining archaeology, dendrochronology and data science +bio: Interdisciplinary scientist combining archaeology, dendrochronology and data science github: RonaldVisser gitlab: RonaldVisser orcid: 0000-0001-6966-1729 diff --git a/content/blog/2024-06-06-from-scripts-to-package/index.md b/content/blog/2024-06-06-from-scripts-to-package/index.md index 5896b57dd1..4ba9b3b9a8 100644 --- a/content/blog/2024-06-06-from-scripts-to-package/index.md +++ b/content/blog/2024-06-06-from-scripts-to-package/index.md @@ -2,8 +2,7 @@ slug: "from-scripts-to-package" title: From scripts to package. Developing dendroNetwork and learning with rOpenSci package_version: 0.5.4 -author: - - Ronald Visser +author: Ronald M. Visser editor: - Steffi LaZerte date: 2024-06-06 diff --git a/themes/ropensci/layouts/blog/list.json.json b/themes/ropensci/layouts/blog/list.json.json index d4d7507c4b..abb180d985 100644 --- a/themes/ropensci/layouts/blog/list.json.json +++ b/themes/ropensci/layouts/blog/list.json.json @@ -21,17 +21,26 @@ {{ $data.Set "authors" .Params.author }} {{ else }} {{ $data.Set "authors" (slice .Params.author) }} + {{ end }} + {{ if isset .Params "editor" }} + {{ if eq (substr (jsonify .Params.editor) 0 1) "[" }} + {{ $data.Set "editors" .Params.editor }} + {{ else }} + {{ $data.Set "editors" (slice .Params.editor) }} + {{ end }} + {{ end }} + {{ if isset .Params "translator" }} + {{ if eq (substr (jsonify .Params.translator) 0 1) "[" }} + {{ $data.Set "translators" .Params.translator }} + {{ else }} + {{ $data.Set "translators" (slice .Params.translator) }} + {{ end }} {{ end }} { "id": "{{ printf "https://doi.org/%s" .Params.doi }}", "title": "{{ .Title }}", "language" : "{{ .Lang }}", - "authors": [{{ range $i, $e := ($data.Get "authors") }}{{ range first 1 (where ($data.Get "pages") ".Params.name" $e) }}{{ $params := .Params }}{{ $name := $params.name }}{{ if $i }}, {{ end }}{{ range first 1 (where ($data.Get "pages") ".Params.name" $e) }} - { - "name": "{{ $name }}", - {{ with .Params.orcid }}"url": "https://orcid.org/{{ . }}" ,{{ end }} - "avatar": "{{ ( partial "blogs/author-img" . ) }}" - }{{ end }}{{ end }}{{ end }}], + "authors": [{{ partial "blogs/combined-authors.html" . }}], {{ with .Params.tags }} "tags": {{ . | uniq | jsonify}},{{ end }} "content_html": {{ .Content | replaceRE "\n" "" | jsonify }}, "url": "{{ .Permalink }}", diff --git a/themes/ropensci/layouts/partials/blogs/combined-authors.html b/themes/ropensci/layouts/partials/blogs/combined-authors.html new file mode 100644 index 0000000000..6a108e1d8a --- /dev/null +++ b/themes/ropensci/layouts/partials/blogs/combined-authors.html @@ -0,0 +1,66 @@ +{{- $editors := .Params.editor -}} +{{- if $editors -}} + {{- if ne (printf "%T" $editors) "[]string" -}} + {{- $editors = slice $editors -}} + {{- end -}} +{{- end -}} + +{{- $translators := .Params.translator -}} +{{- if $translators -}} + {{- if ne (printf "%T" $translators) "[]string" -}} + {{- $translators = slice $translators -}} + {{- end -}} +{{- end -}} + +{{- $authors := .Params.author -}} +{{- if $authors -}} + {{- if ne (printf "%T" $authors) "[]string" -}} + {{- $authors = slice $authors -}} + {{- end -}} +{{- end -}} + +{{- $interviewees := .Params.interviewee -}} +{{- if $interviewees -}} + {{- if ne (printf "%T" $interviewees) "[]string" -}} + {{- $interviewees = slice $interviewees -}} + {{- end -}} +{{- end -}} + +{{- $allPeople := dict -}} + +{{- range $editors -}} + {{/* Look up current person in dictionary, return empty slice if not found */}} + {{- $existing := index $allPeople . | default slice -}} + {{/* Add "editor" to their roles and update the dictionary */}} + {{- $allPeople = merge $allPeople (dict . ($existing | append "editor")) -}} +{{- end -}} + +{{- range $translators -}} + {{- $existing := index $allPeople . | default slice -}} + {{- $allPeople = merge $allPeople (dict . ($existing | append "translator")) -}} +{{- end -}} + +{{- range $authors -}} + {{- $existing := index $allPeople . | default slice -}} + {{- $allPeople = merge $allPeople (dict . ($existing | append "author")) -}} +{{- end -}} + +{{- range $interviewees -}} + {{- $existing := index $allPeople . | default slice -}} + {{- $allPeople = merge $allPeople (dict . ($existing | append "interviewee")) -}} +{{- end -}} + +{{- $personIndex := 0 -}} +{{- range $name, $roles := $allPeople -}} + {{- $personPage := index (where $.Site.Pages ".Params.name" $name) 0 -}} + {{- if $personPage -}} + {{- if $personIndex -}}, {{ end -}} + { + "name": "{{ $name }}", + "url": "{{ if $personPage.Params.orcid }}https://orcid.org/{{ $personPage.Params.orcid }}{{ else }}{{ $personPage.Permalink }}{{ end }}", + "avatar": "{{ ( partial "blogs/author-img" $personPage ) }}", + "_role": {{ $roles | jsonify }} + } + {{- $personIndex = add $personIndex 1 -}} + {{- end -}} +{{- end -}}