mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2025-02-06 20:03:31 +08:00
refactor: drop support for external avatar
This simplifies the code and the configuration file
This commit is contained in:
parent
692804498d
commit
22c7048f89
@ -29,10 +29,7 @@ sidebar:
|
|||||||
emoji:
|
emoji:
|
||||||
subtitle:
|
subtitle:
|
||||||
compact: false
|
compact: false
|
||||||
avatar:
|
avatar: img/avatar.png
|
||||||
enabled: true
|
|
||||||
local: true
|
|
||||||
src: img/avatar.png
|
|
||||||
|
|
||||||
article:
|
article:
|
||||||
# Enable LaTeX math syntax for all pages by default
|
# Enable LaTeX math syntax for all pages by default
|
||||||
|
@ -8,10 +8,7 @@ footer:
|
|||||||
sidebar:
|
sidebar:
|
||||||
emoji: 🍥
|
emoji: 🍥
|
||||||
subtitle: Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
subtitle: Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||||
avatar:
|
avatar: img/logo.jpg
|
||||||
enabled: true
|
|
||||||
local: true
|
|
||||||
src: img/logo.jpg
|
|
||||||
|
|
||||||
comments:
|
comments:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
@ -7,28 +7,17 @@
|
|||||||
|
|
||||||
<header>
|
<header>
|
||||||
{{ with .Site.Params.sidebar.avatar }}
|
{{ with .Site.Params.sidebar.avatar }}
|
||||||
{{ if .enabled }}
|
{{- $avatar := resources.Get . -}}
|
||||||
|
{{- $avatarResized := $avatar.Resize "300x" -}}
|
||||||
|
{{- $src := $avatarResized.RelPermalink -}}
|
||||||
<figure class="site-avatar">
|
<figure class="site-avatar">
|
||||||
<a href="{{ .Site.BaseURL | relLangURL }}">
|
<a href="{{ $.Site.BaseURL | relLangURL }}">
|
||||||
{{ if not .local }}
|
<img src="{{ $src }}" width="300" height="300" class="site-logo" loading="lazy" alt="Avatar">
|
||||||
<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>
|
</a>
|
||||||
{{ with $.Site.Params.sidebar.emoji }}
|
{{ with $.Site.Params.sidebar.emoji }}
|
||||||
<span class="emoji">{{ . }}</span>
|
<span class="emoji">{{ . }}</span>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</figure>
|
</figure>
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
<div class="site-meta">
|
<div class="site-meta">
|
||||||
|
Loading…
Reference in New Issue
Block a user