mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-06 00:14:33 +00:00
Attempt to use anchorize rather than urlize for fetching user profiles for users with non-ASCII usernames. Apparently `anchorize` does not perform URL encoding unlike `urlize`, so may be better suited for use with `GetPage`. See https://github.com/gohugoio/hugo/issues/5687
11 lines
388 B
HTML
11 lines
388 B
HTML
{{- $username := .Get 0 -}}
|
|
{{- $username_url := $username | anchorize -}}
|
|
{{- $taxonomy := "authors" -}}
|
|
{{- $profile_page := site.GetPage (printf "/%s/%s" $taxonomy $username_url) -}}
|
|
{{- $name := $profile_page.Params.name | default ($username|markdownify) -}}
|
|
{{- with $profile_page -}}
|
|
<a href="{{$profile_page.RelPermalink}}">{{$name}}</a>
|
|
{{- else -}}
|
|
{{- $name -}}
|
|
{{- end -}}
|