refactor: simplify sidebar avatar configuration and don't resize (#1247)
This commit is contained in:
@@ -12,11 +12,7 @@ rssFullContent = true
|
|||||||
|
|
||||||
[sidebar]
|
[sidebar]
|
||||||
compact = false
|
compact = false
|
||||||
|
avatar = ""
|
||||||
[sidebar.avatar]
|
|
||||||
enabled = false
|
|
||||||
local = true
|
|
||||||
src = "img/avatar.png"
|
|
||||||
|
|
||||||
[article]
|
[article]
|
||||||
headingAnchor = false
|
headingAnchor = false
|
||||||
|
|||||||
@@ -8,10 +8,7 @@ favicon = "img/avatar.png"
|
|||||||
[sidebar]
|
[sidebar]
|
||||||
emoji = "✏️"
|
emoji = "✏️"
|
||||||
subtitle = "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
|
subtitle = "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
|
||||||
[sidebar.avatar]
|
avatar = "img/avatar.png"
|
||||||
enabled = true
|
|
||||||
local = true
|
|
||||||
src = "img/avatar.png"
|
|
||||||
|
|
||||||
[article]
|
[article]
|
||||||
[article.license]
|
[article.license]
|
||||||
|
|||||||
@@ -7,29 +7,21 @@
|
|||||||
|
|
||||||
<header>
|
<header>
|
||||||
{{ with .Site.Params.sidebar.avatar }}
|
{{ with .Site.Params.sidebar.avatar }}
|
||||||
{{ if .enabled }}
|
{{- $avatar := partial "helper/image" (dict "Image" . "Resources" resources) -}}
|
||||||
<figure class="site-avatar">
|
<figure class="site-avatar">
|
||||||
<a href="{{ .Site.BaseURL | relLangURL }}">
|
<a href="{{ $.Site.BaseURL | relLangURL }}">
|
||||||
{{ if not .local }}
|
<img src="{{ $avatar.Permalink }}"
|
||||||
<img src="{{ .src }}" width="300" height="300" class="site-logo" loading="lazy" alt="Avatar">
|
width="{{ $avatar.Width }}"
|
||||||
{{ else }}
|
height="{{ $avatar.Height }}"
|
||||||
{{ $avatar := resources.Get (.src) }}
|
class="site-logo"
|
||||||
|
loading="lazy"
|
||||||
{{ if $avatar }}
|
alt="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">
|
||||||
<h1 class="site-name"><a href="{{ .Site.BaseURL | relLangURL }}">{{ .Site.Title }}</a></h1>
|
<h1 class="site-name"><a href="{{ .Site.BaseURL | relLangURL }}">{{ .Site.Title }}</a></h1>
|
||||||
|
|||||||
Reference in New Issue
Block a user