BUGFIX fix incorrect url of default avatar or background images

This commit is contained in:
FarseaSH 2024-07-30 22:59:34 +08:00
parent 09c1f46140
commit cf555c8a73
5 changed files with 18 additions and 6 deletions

BIN
assets/default-avatar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

View file

@ -1,4 +1,11 @@
<div class="jumbotron" style="background-image: url({{ .Site.Params.cover }});">
{{ $background_path := "default-background.png" }}
{{ with .Site.Params.cover }}
{{ $background_path = . }}
{{ end }}
{{ if resources.Get $background_path }}
{{ $background_path = (resources.Get $background_path).Permalink }}
{{ end }}
<div class="jumbotron" style="background-image: url({{ $background_path }});">
<div class="container">
<div class="site-title">{{ .Site.Params.title }}</div>
<p class="signature">{{ .Site.Params.signature }}</p>

View file

@ -25,12 +25,17 @@
{{/* user info */}}
<div class="user-info">
<div class="avatar-block">
{{ with $page.Params.avatar }}
<img src='{{ . }}' class="avatar">
{{ else }}
{{/* fixme check whether the default avatar path is url or not--> */}}
<img src='{{ $page.Site.BaseURL }}/{{ $page.Site.Params.avatar }}' class="avatar">
{{ $avatar_path := "default-avatar.png" }}
{{ with .Site.Params.avatar }}
{{ $avatar_path = . }}
{{ end }}
{{ with $page.Params.avatar }}
{{ $avatar_path = . }}
{{ end }}
{{ if resources.Get $avatar_path }}
{{ $avatar_path = (resources.Get $avatar_path).Permalink }}
{{ end }}
<img src='{{ $avatar_path }}' class="avatar">
</div>
<div class="intro">
<div class="name">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB