mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-06 20:15:01 +00:00
- Re-refactor code to use Hugo's `GetTerms` function now that Hugo fixed the unordered bug - GetTerms may provide better support for names with unicode or spaces - Make avatar pic linked (in addition to name) Close #1750
20 lines
861 B
HTML
20 lines
861 B
HTML
{{/* Author profile box */}}
|
|
|
|
{{/* Don't show author box on normal pages or if author box disabled. */}}
|
|
{{ if ne .Type "page" | and (not (or (eq site.Params.profile false) (eq .Params.profile false))) }}
|
|
|
|
{{/* Display superuser if superuser exists and page authors are not explicitly specified. */}}
|
|
{{/* Otherwise, display first author if a profile for them exists. */}}
|
|
|
|
{{ if and (not .Params.authors) (.Scratch.Get "superuser_username") }}
|
|
{{ $author_page := site.GetPage (printf "/%s/%s" "authors" (.Scratch.Get "superuser_username")) }}
|
|
{{ partial "page_author_card" (dict "author_page" $author_page) }}
|
|
{{ else if .Params.authors }}
|
|
{{ $taxonomy := "authors" }}
|
|
{{ range $author_obj := (.GetTerms $taxonomy) }}
|
|
{{ partial "page_author_card" (dict "author_page" $author_obj.Page) }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{end}}{{/* Show profile block */}}
|