www/layouts/_default/contributor.json
Michał Szczepanik d731e55f08
Customize JSON output for contributors
This adds a custom JSON rendering for contributor pages. Properties
are explicitly selected from the .Params in line with the html
template.
2024-12-13 15:53:50 +01:00

16 lines
601 B
JSON

{{- /* collect permalinks to term-related pages */ -}}
{{- $relatedPermalinks := slice -}}
{{- range .Pages -}}
{{- $relatedPermalinks = $relatedPermalinks | append .Permalink -}}
{{- end -}}
{{/* make a selection of params and other properties */}}
{{- $selected := dict
"permalink" .Permalink
"related" $relatedPermalinks
"content" (.Plain | emojify )
"orcid" (.Param "orcid")
"affiliation" (.Param "affiliation")
"see_also" (dict (.Param "seealso-text" | default "Homepage" ) (.Param "seealso-link"))
-}}
{{/* merge those things with params, serve that */}}
{{ $selected | jsonify }}