-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
/
about.avatar.html
93 lines (81 loc) · 3.17 KB
/
about.avatar.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
{{/* Wowchemy Blocks: About - avatar variation */}}
{{/* Documentation: https://wowchemy.com/blocks/ */}}
{{/* License: https://github.com/wowchemy/wowchemy-hugo-themes/blob/main/LICENSE.md */}}
{{/* Initialise */}}
{{ $page := .wcPage }}
{{ $block := .wcBlock }}
{{ $author := "" }}
{{ if .author }}
{{ $author = .author }}
{{ else }}
{{ $author = $block.content.username }}
{{end}}
{{ $person_page_path := (printf "/authors/%s" $author) }}
{{ $person_page := site.GetPage $person_page_path }}
{{ if not $person_page }}
{{ errorf "Could not find an author page at `%s`. Please check the value of `author` in your About widget and create an associated author page if one does not already exist. See https://wowchemy.com/docs/page-builder/#about " $person_page_path }}
{{end}}
{{ $person := $person_page.Params }}
{{ $avatar := ($person_page.Resources.ByType "image").GetMatch "*avatar*" }}
{{ $avatar_shape := site.Params.features.avatar.shape | default "circle" }}
<div id="profile">
{{ if $avatar }}
<div class="avatar-wrapper">
{{ $avatar_image := $avatar.Fill "150x150 Center" }}
<img class="avatar {{if eq $avatar_shape "square"}}avatar-square{{else}}avatar-circle{{end}}" src="{{ $avatar_image.RelPermalink }}" alt="{{$person_page.Title}}"
width="{{ $avatar_image.Width }}" height="{{ $avatar_image.Height }}">
{{with $person.status.icon}}<span class="avatar-emoji">{{.|emojify}}</span>{{end}}
</div>
{{ end }}
<div class="portrait-title">
<h2>
{{- if $person.name_pronunciation -}}
<ruby>
<rb>{{ $person_page.Title }}</rb>
<rt>{{ $person.name_pronunciation }}</rt>
</ruby>
{{- else -}}
{{- $person_page.Title -}}
{{- end -}}
</h2>
{{ with $person.role }}<h3>{{ . | markdownify | emojify }}</h3>{{ end }}
{{ range $person.organizations }}
<h3>
{{ with .url }}<a href="{{ . }}" target="_blank" rel="noopener">{{ end }}
<span>{{ .name }}</span>
{{ if .url }}</a>{{ end }}
</h3>
{{ end }}
</div>
<ul class="network-icon" aria-hidden="true">
{{ range $person.social }}
{{ $pack := or .icon_pack "fas" }}
{{ $pack_prefix := $pack }}
{{ if in (slice "fab" "fas" "far" "fal") $pack }}
{{ $pack_prefix = "fa" }}
{{ end }}
{{ $link := .link }}
{{ $scheme := (urls.Parse $link).Scheme }}
{{ $target := "" }}
{{ if not $scheme }}
{{ $link = .link | relLangURL }}
{{ if eq (path.Ext $link) ".pdf" }}{{ $target = "target=\"_blank\" rel=\"noopener\"" }}{{ end }}
{{ else if in (slice "http" "https") $scheme }}
{{ $target = "target=\"_blank\" rel=\"noopener\"" }}
{{ end }}
<li>
<a href="{{ $link | safeURL }}" {{ $target | safeHTMLAttr }} aria-label="{{ .icon }}"
{{ with .label }} data-toggle="tooltip" data-placement="top" title="{{.}}"{{ end }}>
<i class="{{ $pack }} {{ $pack_prefix }}-{{ .icon }} big-icon"></i>
</a>
</li>
{{ end }}
</ul>
{{ with ($block.content.text | emojify | markdownify) | default $person_page.Content }}
<div class="article-style pt-2 d-flex justify-content-center">
<div class="bio-text">
{{ . }}
</div>
</div>
{{ end }}
</div>