whoops, my bad,
it’s because the $data
not calling correct contributor
map yet.
Need to call correct contributor map data using index
:
{{ range .Params.contributor }}
{{- $name := replace .name " " "-" -}}
{{- $data := index $.Site.Data.contributors $name -}}
....
{{ end }}
{{- $baseURL := substr .Site.BaseURL 0 -1 -}}
{{- $imgCDN := .Site.Params.cloudinaryURL -}}
{{- $avatarSRC := printf "%s%s" $imgCDN "/static/avatars/" -}}
{
"@type" : "contributor",
"person": [
{{ range .Params.contributor }}
++ {{- $name := replace .name " " "-" -}}
++ {{- $data := index $.Site.Data.contributors $name -}}
{{- $contributorPath:= printf "%s%s" $baseURL "/about/contributors/" -}}
-- {{- $name := replace .name " " "-" -}}
{{- $contributorURL := printf "%s%s" $contributorPath $name -}}
-- {{- $GUID := printf "%s%s" "/#/schema/person/" .guid }}
++ {{- $GUID := printf "%s%s" "/#/schema/person/" $data.guid }}
{
"@type" : "Person",
"@id" : "{{- printf "%s%s" $baseURL $GUID }}",
"name" : "{{- .name -}}",
"url" : "{{- $contributorURL -}}",
"image" : {
"@type" : "ImageObject",
"@id" : "{{- printf "%s%s" $contributorURL "/#avatar" -}}",
-- "contentUrl" : "{{- printf "%s%s" $avatarSRC .avatar -}}",
++ "contentUrl" : "{{- printf "%s%s" $avatarSRC $data.avatar -}}",
-- "caption" : "{{- .avatarCaption | safeHTML -}}",
++ "caption" : "{{- $data.avatarCaption | safeHTML -}}",
"inLanguage" : "en-US"
},
-- "description": "{{- .bio | safeHTML -}}",
++ "description": "{{- $data.bio | safeHTML -}}",
"sameAs" : [
-- {{- range $comma, $e := .links -}}
++ {{- range $comma, $e := $data.links -}}
{{- if $comma -}},{{- end }}
"{{ . }}"{{- end }}
]
}{{ end }}
]
}