This repository has been archived on 2024-11-25. You can view files and clone it, but cannot push or open issues or pull requests.

115 lines
4.2 KiB
HTML
Raw Normal View History

2023-10-12 14:01:05 +02:00
{{- $profile := .Site.Params.home.profile -}}
<div class="home-profile">
{{- $avatar := $profile.avatarURL -}}
{{- $gravatar := .Site.Params.gravatar -}}
{{- if $gravatar.enable | and $profile.gravatarEmail -}}
{{- with $gravatar -}}
{{- $avatar = printf "https://%v/avatar/%v?s=240&d=%v"
(path.Clean .Host | default "www.gravatar.com")
(md5 $profile.gravatarEmail)
(.Style | default "mp")
-}}
{{- end -}}
{{- end -}}
{{- if $avatar -}}
<div class="home-avatar">
{{- $menus := $.Site.Menus.main | default slice -}}
{{- $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" $.Site.Author.name | partial "plugin/image.html" -}}
</a>
{{- else -}}
{{- dict "Src" $avatar "Alt" $.Site.Author.name | partial "plugin/image.html" -}}
{{- end -}}
</div>
{{- end -}}
{{- 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 "Id" "typeit-profile-subtitle" | partial "function/id.html" -}}
<span class="d-none">{{ . }}</span>
<span id="{{ $id }}" class="typeit"></span>
{{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}}
{{- else -}}
{{- . -}}
{{- end -}}
</h2>
{{- 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 -}}
{{- $social = dict "Icon" . | merge $social -}}
{{- end -}}
{{- 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 -}}
{{- /* Custom Content */ -}}
{{- partial (.Scratch.Get "customFilePath").profile . -}}
</div>