Fix the single template to use the authors avatar correctly (#107)

* Fix the single template to use the authors avatar correctly

* Replace absURL with relURL and .Site.X with site.X

Co-authored-by: Emruz Hossain <emruz@appscode.com>
This commit is contained in:
alex bezek 2020-10-24 22:07:18 -04:00 committed by GitHub
parent 4d19b2f8d1
commit d0c32c5d08
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 86 additions and 80 deletions

View file

@ -1,6 +1,6 @@
{{ $author:= .Site.Data.author }}
{{ if (index .Site.Data .Site.Language.Lang).author }}
{{ $author = (index .Site.Data .Site.Language.Lang).author }}
{{ $author:= site.Data.author }}
{{ if (index site.Data site.Language.Lang).author }}
{{ $author = (index site.Data site.Language.Lang).author }}
{{ end }}
{{ $name:="Jane Doe" }}
@ -10,17 +10,17 @@
{{ $name = $author.name }}
{{ end }}
{{ $sections:= .Site.Data.sections }}
{{ if (index .Site.Data .Site.Language.Lang).sections }}
{{ $sections = (index .Site.Data .Site.Language.Lang).sections }}
{{ $sections:= site.Data.sections }}
{{ if (index site.Data site.Language.Lang).sections }}
{{ $sections = (index site.Data site.Language.Lang).sections }}
{{ end }}
{{ $backgroundImage:= "assets/images/default-background.jpg" }}
{{ if .Site.Params.background }}
{{ $backgroundImage = .Site.Params.background }}
{{ $backgroundImage:= "/assets/images/default-background.jpg" }}
{{ if site.Params.background }}
{{ $backgroundImage = site.Params.background }}
{{ end }}
{{ $authorImage:= "assets/images/default-avatar.png" }}
{{ $authorImage:= "/assets/images/default-avatar.png" }}
{{ if $author.image }}
{{ $authorImage = $author.image }}
{{ end }}
@ -28,10 +28,10 @@
<div class="container-fluid home" id="home">
<div
class="background container-fluid"
style="background-image: url('{{ $backgroundImage | absURL }}');"
style="background-image: url('{{ strings.TrimSuffix "/" site.BaseURL }}{{ $backgroundImage | relURL }}');"
></div>
<div class="container content text-center">
<img src="{{ $authorImage | absURL }}"
<img src="{{ $authorImage | relURL }}"
class="rounded-circle mx-auto d-block img-fluid"
/>
<h1 class="greeting"> {{ $author.greeting }} {{ $name }}</h1>