LoveIt/layouts/partials/home/profile.html

73 lines
2.9 KiB
HTML
Raw Normal View History

{{- $profile := .Site.Params.home.profile -}}
2020-02-13 18:30:33 +01:00
<div class="home-profile">
{{- $avatar := $profile.avatarURL -}}
{{- with $profile.gravatarEmail -}}
{{- $avatar = md5 . | printf "https://www.gravatar.com/avatar/%s?s=240&d=mp" -}}
2020-01-31 15:53:04 +01:00
{{- end -}}
{{- if $avatar -}}
2019-08-24 13:32:41 +02:00
<div class="home-avatar">
{{- $menus := $.Site.Menus.main | default slice -}}
{{- with index $menus 0 -}}
{{- $url := .URL | relLangURL -}}
{{- with .Page -}}
{{- $url = .RelPermalink -}}
{{- end -}}
<a href="{{ $url }}"{{ with .Title | default .Name }} title="{{ . }}"{{ end }}{{ if (urls.Parse $url).Host }} rel="noopener noreffer" target="_blank"{{ end }}>
{{- dict "src" $avatar "alt" .Name | partial "plugin/image.html" -}}
</a>
{{- else -}}
{{- dict "src" $avatar | partial "plugin/image.html" -}}
{{- end -}}
2019-08-10 21:26:03 +02:00
</div>
2020-01-31 15:53:04 +01:00
{{- end -}}
2019-08-10 21:26:03 +02:00
{{- with $profile.title -}}
<h1 class="home-title">
{{- . | safeHTML -}}
</h1>
{{- end -}}
{{- with $profile.subtitle -}}
<h2 class="home-subtitle">
{{- if $profile.typeit -}}
{{- $id := dict "content" . "scratch" $.Scratch | partial "function/id.html" -}}
2020-02-27 13:14:40 +01:00
<div id="{{ $id }}" class="typeit"></div>
{{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}}
2020-01-31 15:53:04 +01:00
{{- else -}}
2020-02-24 10:00:39 +01:00
{{- . -}}
2020-01-31 15:53:04 +01:00
{{- end -}}
2019-08-10 21:26:03 +02:00
</h2>
2020-01-31 15:53:04 +01:00
{{- end -}}
2019-08-10 21:26:03 +02:00
{{- 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 -}}
{{- $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 $profile.disclaimer -}}
<h3 class="home-disclaimer">
{{- . | safeHTML -}}
</h3>
{{- end -}}
2019-08-10 21:26:03 +02:00
</div>