feat(sidebar): add option to disable avatar in left sidebar (#268)

* Allow to disable logo image in left sidebar

* Enable sidebar avatar by default for backward compatibility

Co-authored-by: Jimmy Cai <github@jimmycai.com>
This commit is contained in:
Hendra Manudinata 2021-07-23 16:56:52 +08:00 committed by GitHub
parent 8cb11d721f
commit a25e6463bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

View File

@ -37,6 +37,7 @@ params:
emoji: 🍥 emoji: 🍥
subtitle: Lorem ipsum dolor sit amet, consectetur adipiscing elit. subtitle: Lorem ipsum dolor sit amet, consectetur adipiscing elit.
avatar: avatar:
enabled: true
local: true local: true
src: img/avatar.png src: img/avatar.png

View File

@ -7,6 +7,7 @@
<header class="site-info"> <header class="site-info">
{{ with .Site.Params.sidebar.avatar }} {{ with .Site.Params.sidebar.avatar }}
{{ if (default true .enabled) }}
<figure class="site-avatar"> <figure class="site-avatar">
{{ if not .local }} {{ 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">
@ -27,6 +28,7 @@
{{ end }} {{ end }}
</figure> </figure>
{{ end }} {{ end }}
{{ end }}
<h1 class="site-name"><a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a></h1> <h1 class="site-name"><a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a></h1>
<h2 class="site-description">{{ .Site.Params.sidebar.subtitle }}</h2> <h2 class="site-description">{{ .Site.Params.sidebar.subtitle }}</h2>
</header> </header>