LoveIt/layouts/partials/home/profile.html

66 lines
2.8 KiB
HTML

<div class="home-profile">
{{- $avatar := .Site.Params.home.profile.avatarURL -}}
{{- with .Site.Params.home.profile.gravatarEmail -}}
{{- $avatar = md5 . | printf "https://www.gravatar.com/avatar/%s?s=240&d=mp" -}}
{{- end -}}
{{- if $avatar -}}
<div class="home-avatar">
{{- $firstMenu := "" -}}
{{- if .Site.Menus.main -}}
{{- range first 1 $.Site.Menus.main -}}
{{- $firstMenu = . -}}
{{- end -}}
{{- end -}}
{{- with $firstMenu -}}
<a href="{{- .URL -}}" title="{{- .Name -}}">
{{- dict "src" $avatar "alt" .Name | partial "plugin/image.html" -}}
</a>
{{- else -}}
{{- dict "src" $avatar "alt" " " | partial "plugin/image.html" -}}
{{- end -}}
</div>
{{- end -}}
{{- with .Site.Params.home.profile.subtitle -}}
<h2 class="home-subtitle">
{{- if $.Site.Params.home.profile.typeit -}}
{{- $id := dict "content" . "scratch" $.Scratch | partial "function/id.html" -}}
<div id="{{ $id }}" class="typeit"></div>
{{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}}
{{- else -}}
{{- . -}}
{{- end -}}
</h2>
{{- end -}}
{{- if .Site.Params.home.profile.social -}}
<div class="social-links">
{{- $socialMap := resources.Get "data/social.yaml" | transform.Unmarshal -}}
{{- $socialArr := slice -}}
{{- range $key, $value := .Site.Params.social -}}
{{- $social := $key | lower | index $socialMap | default dict -}}
{{- if $value -}}
{{- if reflect.IsMap $value -}}
{{- $social = $value | merge $social -}}
{{- else if ne $value true -}}
{{- $social = dict "id" $value | merge $social -}}
{{- end -}}
{{- if $social.icon.simpleicons -}}
{{- $prefix := ($.Scratch.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 .Site.Params.home.profile.disclaimer -}}
<h3 class="home-disclaimer">
{{- . | safeHTML -}}
</h3>
{{- end -}}
</div>