forked from Sync/hugo-theme-stack
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:
|
||||
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
|
||||
|
@ -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
|
||||
|
@ -7,29 +7,18 @@
|
||||
|
||||
<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">
|
||||
<h1 class="site-name"><a href="{{ .Site.BaseURL | relLangURL }}">{{ .Site.Title }}</a></h1>
|
||||
|
Loading…
Reference in New Issue
Block a user