fix(sidebar): check if param exists before accessing avatar and icon
This commit is contained in:
parent
a6870541dd
commit
2d94f80b79
@ -6,6 +6,7 @@
|
|||||||
</button>
|
</button>
|
||||||
|
|
||||||
<header class="site-info">
|
<header class="site-info">
|
||||||
|
{{ if .Site.Params.avatar }}
|
||||||
<figure class="site-avatar">
|
<figure class="site-avatar">
|
||||||
{{ $avatar := resources.Get (.Site.Params.avatar) }}
|
{{ $avatar := resources.Get (.Site.Params.avatar) }}
|
||||||
{{ $avatarResized := $avatar.Resize "300x300" }}
|
{{ $avatarResized := $avatar.Resize "300x300" }}
|
||||||
@ -13,6 +14,7 @@
|
|||||||
height="{{ $avatarResized.Height }}" class="site-logo" loading="lazy" alt="Avatar">
|
height="{{ $avatarResized.Height }}" class="site-logo" loading="lazy" alt="Avatar">
|
||||||
<span class="emoji">{{ .Site.Params.emoji }}</span>
|
<span class="emoji">{{ .Site.Params.emoji }}</span>
|
||||||
</figure>
|
</figure>
|
||||||
|
{{ 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.subtitle }}</h2>
|
<h2 class="site-description">{{ .Site.Params.subtitle }}</h2>
|
||||||
</header>
|
</header>
|
||||||
@ -24,7 +26,9 @@
|
|||||||
|
|
||||||
<li {{ if $active }} class='current' {{ end }}>
|
<li {{ if $active }} class='current' {{ end }}>
|
||||||
<a href='{{ .URL }}'>
|
<a href='{{ .URL }}'>
|
||||||
|
{{ if .Pre }}
|
||||||
{{ (resources.Get (delimit (slice "icons/" .Pre ".svg") "")).Content | safeHTML }}
|
{{ (resources.Get (delimit (slice "icons/" .Pre ".svg") "")).Content | safeHTML }}
|
||||||
|
{{ end }}
|
||||||
<span>{{- .Name -}}</span>
|
<span>{{- .Name -}}</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
Loading…
Reference in New Issue
Block a user