refactor: drop support for external avatar

This simplifies the code and the configuration file
This commit is contained in:
Jimmy Cai
2023-09-11 18:40:53 +02:00
parent 692804498d
commit 22c7048f89
3 changed files with 7 additions and 24 deletions
+5 -16
View File
@@ -7,28 +7,17 @@
<header>
{{ with .Site.Params.sidebar.avatar }}
{{ if .enabled }}
{{- $avatar := resources.Get . -}}
{{- $avatarResized := $avatar.Resize "300x" -}}
{{- $src := $avatarResized.RelPermalink -}}
<figure class="site-avatar">
<a href="{{ .Site.BaseURL | relLangURL }}">
{{ if not .local }}
<img src="{{ .src }}" width="300" height="300" class="site-logo" loading="lazy" alt="Avatar">
{{ else }}
{{ $avatar := resources.Get (.src) }}
{{ if $avatar }}
{{ $avatarResized := $avatar.Resize "300x" }}
<img src="{{ $avatarResized.RelPermalink }}" width="{{ $avatarResized.Width }}"
height="{{ $avatarResized.Height }}" class="site-logo" loading="lazy" alt="Avatar">
{{ else }}
{{ errorf "Failed loading avatar from %q" . }}
{{ end }}
{{ end }}
<a href="{{ $.Site.BaseURL | relLangURL }}">
<img src="{{ $src }}" width="300" height="300" class="site-logo" loading="lazy" alt="Avatar">
</a>
{{ with $.Site.Params.sidebar.emoji }}
<span class="emoji">{{ . }}</span>
{{ end }}
</figure>
{{ end }}
{{ end }}
<div class="site-meta">