mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
121 lines
4.6 KiB
HTML
121 lines
4.6 KiB
HTML
{{- $profile := .Site.Params.home.profile -}}
|
|
{{- $author := partial "function/get-author-map.html" .Params.author -}}
|
|
|
|
<div class="home-profile">
|
|
{{- $avatar := dict "Email" $profile.gravatarEmail "Size" "96" | partial "function/get-gravatar.html" | default $profile.avatarURL | default $author.avatar -}}
|
|
{{- if $avatar -}}
|
|
<div class="home-avatar">
|
|
{{- $menus := $.Site.Menus.main | default slice -}}
|
|
{{- $optim := slice
|
|
(dict "Process" "fill center 96x96 webp" "descriptor" "96w")
|
|
(dict "Process" "fill center 144x144 webp" "descriptor" "144w")
|
|
(dict "Process" "fill center 192x192 webp" "descriptor" "192w")
|
|
-}}
|
|
{{- $avatarMenuIndex := 0 -}}
|
|
{{- if $profile.avatarMenu -}}
|
|
{{- range $index, $menu := $menus -}}
|
|
{{- if eq $menu.Identifier $profile.avatarMenu -}}
|
|
{{- $avatarMenuIndex = $index -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- with index $menus $avatarMenuIndex -}}
|
|
{{- $url := .URL | relLangURL -}}
|
|
{{- with .Page -}}
|
|
{{- $url = .RelPermalink -}}
|
|
{{- end -}}
|
|
<a href="{{ $url }}"{{ with .Title | default .Name }} title="{{ . }}"{{ end }}{{ if (urls.Parse $url).Host }} rel="noopener noreferrer" target="_blank"{{ end }}>
|
|
{{- dict "Src" $avatar "Alt" "Home avatar" "Width" 96 "Height" 96 "OptimConfig" $optim | partial "plugin/image.html" -}}
|
|
</a>
|
|
{{- else -}}
|
|
{{- dict "Src" $avatar "Alt" "Home avatar" "Width" 96 "Height" 96 "OptimConfig" $optim | partial "plugin/image.html" -}}
|
|
{{- end -}}
|
|
</div>
|
|
{{- end -}}
|
|
|
|
<h1 class="home-title">
|
|
{{- with $profile.title -}}
|
|
{{- . | safeHTML -}}
|
|
{{- end -}}
|
|
</h1>
|
|
|
|
{{- with $profile.subtitle -}}
|
|
<p class="home-subtitle">
|
|
{{- if $profile.typeit -}}
|
|
<span class="d-none">{{ . }}</span>
|
|
{{- $.Store.Set "hasTyped" true -}}
|
|
<span class="typeit"><template>{{ . | safeHTML }}</template></span>
|
|
{{- else -}}
|
|
{{- . | safeHTML -}}
|
|
{{- end -}}
|
|
</p>
|
|
{{- end -}}
|
|
|
|
{{- if $profile.social -}}
|
|
<div class="links">
|
|
{{- $socialMap := resources.Get "data/social.yml" | transform.Unmarshal -}}
|
|
{{- $socialArr := slice -}}
|
|
{{- range $key, $value := .Site.Params.social -}}
|
|
{{- $social := $key | lower | index $socialMap | default dict -}}
|
|
{{- if $value -}}
|
|
{{- if reflect.IsMap $value -}}
|
|
{{- with $value.weight -}}
|
|
{{- $social = dict "Weight" . | merge $social -}}
|
|
{{- end -}}
|
|
{{- with $value.prefix -}}
|
|
{{- $social = dict "Prefix" . | merge $social -}}
|
|
{{- end -}}
|
|
{{- with $value.template -}}
|
|
{{- $social = dict "Template" . | merge $social -}}
|
|
{{- end -}}
|
|
{{- with $value.id -}}
|
|
{{- $social = dict "Id" . | merge $social -}}
|
|
{{- end -}}
|
|
{{- with $value.url -}}
|
|
{{- $social = dict "Url" . | merge $social -}}
|
|
{{- end -}}
|
|
{{- with $value.title -}}
|
|
{{- $social = dict "Title" . | merge $social -}}
|
|
{{- end -}}
|
|
{{- with $value.newtab -}}
|
|
{{- $social = dict "Newtab" . | merge $social -}}
|
|
{{- end -}}
|
|
{{- with $value.icon -}}
|
|
{{- $icon := dict -}}
|
|
{{- with .class -}}
|
|
{{- $icon = dict "Class" . | merge $icon -}}
|
|
{{- end -}}
|
|
{{- with .simpleicons -}}
|
|
{{- $icon = dict "Simpleicons" . | merge $icon -}}
|
|
{{- end -}}
|
|
{{- with .src -}}
|
|
{{- $icon = dict "Src" . | merge $icon -}}
|
|
{{- end -}}
|
|
{{- $social = dict "Icon" $icon | merge $social -}}
|
|
{{- end -}}
|
|
{{- else if ne $value true -}}
|
|
{{- $social = dict "Id" $value | merge $social -}}
|
|
{{- end -}}
|
|
{{- if $social.Icon.Simpleicons -}}
|
|
{{- $prefix := ($.Site.Store.Get "cdn" | default dict).simpleIconsPrefix -}}
|
|
{{- $social = dict "Prefix" $prefix | dict "Icon" | merge $social -}}
|
|
{{- end -}}
|
|
{{- $socialArr = $socialArr | append $social -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- range sort $socialArr "Weight" -}}
|
|
{{- partial "plugin/social.html" . -}}
|
|
{{- end -}}
|
|
</div>
|
|
{{- end -}}
|
|
|
|
{{- with $profile.disclaimer -}}
|
|
<h3 class="home-disclaimer">
|
|
{{- . | safeHTML -}}
|
|
</h3>
|
|
{{- end -}}
|
|
|
|
{{- /* Custom Profile */ -}}
|
|
{{- block "custom-profile" . }}{{ end -}}
|
|
</div>
|