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 committed by Yupeng Chen
parent a93c12b552
commit 406741b8aa
Signed by: cyp0633
GPG Key ID: A9F96679CAF4A2B9
3 changed files with 7 additions and 24 deletions

View File

@ -29,10 +29,7 @@ sidebar:
emoji:
subtitle:
compact: false
avatar:
enabled: true
local: true
src: img/avatar.png
avatar: img/avatar.png
article:
# Enable LaTeX math syntax for all pages by default

View File

@ -8,10 +8,7 @@ footer:
sidebar:
emoji: 🍥
subtitle: Lorem ipsum dolor sit amet, consectetur adipiscing elit.
avatar:
enabled: true
local: true
src: img/logo.jpg
avatar: img/logo.jpg
comments:
enabled: true

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">