main
html 58 lines 2.79 KB
Raw
1 <div class="profile">
2 {{- with site.Params.profileMode }}
3 <div class="profile_inner">
4 {{- if .imageUrl -}}
5 {{- $img := "" }}
6 {{- if not (urls.Parse .imageUrl).IsAbs }}
7 {{- $img = resources.Get .imageUrl }}
8 {{- end }}
9 {{- if $img }}
10 {{- $processableFormats := (slice "jpg" "jpeg" "png" "tif" "bmp" "gif") -}}
11 {{- if hugo.IsExtended -}}
12 {{- $processableFormats = $processableFormats | append "webp" -}}
13 {{- end -}}
14 {{- $prod := (hugo.IsProduction | or (eq site.Params.env "production")) }}
15 {{- if and (in $processableFormats $img.MediaType.SubType) (eq $prod true)}}
16 {{- if (not (and (not .imageHeight) (not .imageWidth))) }}
17 {{- $img = $img.Resize (printf "%dx%d" .imageWidth .imageHeight) }}
18 {{- else if .imageHeight }}
19 {{- $img = $img.Resize (printf "x%d" .imageHeight) }}
20 {{ else if .imageWidth }}
21 {{- $img = $img.Resize (printf "%dx" .imageWidth) }}
22 {{ else }}
23 {{- $img = $img.Resize "150x150" }}
24 {{- end }}
25 {{- end }}
26 <img draggable="false" src="{{ $img.Permalink }}" alt="{{ .imageTitle | default "profile image" }}" title="{{ .imageTitle }}"
27 height="{{ .imageHeight | default 150 }}" width="{{ .imageWidth | default 150 }}" />
28 {{- else }}
29 <img draggable="false" src="{{ .imageUrl | absURL }}" alt="{{ .imageTitle | default "profile image" }}" title="{{ .imageTitle }}"
30 height="{{ .imageHeight | default 150 }}" width="{{ .imageWidth | default 150 }}" />
31 {{- end }}
32 {{- end }}
33 <h1>{{ .title | default site.Title | markdownify }}</h1>
34 <span>{{ .subtitle | markdownify }}</span>
35 {{- partial "social_icons.html" -}}
36
37 {{- with .buttons }}
38 <div class="buttons">
39 {{- range . }}
40 <a class="button" href="{{ trim .url " " }}" rel="noopener" title="{{ .name }}">
41 <span class="button-inner">
42 {{ .name }}
43 {{- if (findRE "://" .url) }}&nbsp;
44 <svg fill="none" shape-rendering="geometricPrecision" stroke="currentColor" stroke-linecap="round"
45 stroke-linejoin="round" stroke-width="2.5" viewBox="0 0 24 24" height="14" width="14">
46 <path d="M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6"></path>
47 <path d="M15 3h6v6"></path>
48 <path d="M10 14L21 3"></path>
49 </svg>
50 {{- end }}
51 </span>
52 </a>
53 {{- end }}
54 </div>
55 {{- end }}
56 </div>
57 {{- end}}
58 </div>