🚚 Move author image to assets

pull/100/head
James Panther 2022-01-11 12:29:21 +11:00
parent 6eab5f95fb
commit 1b9b660abe
No known key found for this signature in database
GPG Key ID: D36F789E45745D17
6 changed files with 25 additions and 9 deletions

1
.gitignore vendored
View File

@ -143,5 +143,6 @@ hugo.linux
# End of https://www.toptal.com/developers/gitignore/api/hugo # End of https://www.toptal.com/developers/gitignore/api/hugo
exampleSite/public/ exampleSite/public/
exampleSite/resources/_gen/
TODO TODO
.lighthouseci .lighthouseci

View File

@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### Changed ### Changed
- Upgrade to Tailwind v3.0.12 - Upgrade to Tailwind v3.0.12
- Author images are now Hugo assets
## [1.6.2] - 2022-01-07 ## [1.6.2] - 2022-01-07

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -11,7 +11,7 @@ dateFormat = "2 January 2006"
[author] [author]
name = "Congo" name = "Congo"
image = "img/author.jpg" image = "author.jpg"
bio = "This is an example author bio, and although there's a stock photo of a dog here, this article was actually created by a human. :dog:" bio = "This is an example author bio, and although there's a stock photo of a dog here, this article was actually created by a human. :dog:"
links = [ links = [
{ twitter = "https://twitter.com/" }, { twitter = "https://twitter.com/" },

View File

@ -1,13 +1,17 @@
{{ if .Params.showAuthor | default (.Site.Params.article.showAuthor | default true) }} {{ if .Params.showAuthor | default (.Site.Params.article.showAuthor | default true) }}
<div class="flex"> <div class="flex">
{{ with .Site.Author.image }} {{ with .Site.Author.image }}
<img {{ $authorImage := resources.Get . }}
class="w-24 h-24 !mt-0 !mb-0 mr-4 rounded-full" {{ if $authorImage }}
width="96" {{ $authorImage := $authorImage.Fill "192x192" }}
height="96" <img
alt="Author" class="w-24 h-24 !mt-0 !mb-0 mr-4 rounded-full"
src="{{ . | relURL }}" width="96"
/> height="96"
alt="Author"
src="{{ $authorImage.RelPermalink }}"
/>
{{ end }}
{{ end }} {{ end }}
<div class="place-self-center"> <div class="place-self-center">
{{ with .Site.Author.name | markdownify | emojify }} {{ with .Site.Author.name | markdownify | emojify }}

View File

@ -5,7 +5,17 @@
> >
<header class="flex flex-col items-center mb-3"> <header class="flex flex-col items-center mb-3">
{{ with .Site.Author.image }} {{ with .Site.Author.image }}
<img class="mb-2 rounded-full w-36 h-36" alt="Author" src="{{ . | relURL }}" /> {{ $authorImage := resources.Get . }}
{{ if $authorImage }}
{{ $authorImage := $authorImage.Fill "288x288" }}
<img
class="mb-2 rounded-full w-36 h-36"
width="144"
height="144"
alt="Author"
src="{{ $authorImage.RelPermalink }}"
/>
{{ end }}
{{ end }} {{ end }}
<h1 class="text-4xl font-extrabold"> <h1 class="text-4xl font-extrabold">
{{ .Site.Author.name | default .Site.Title }} {{ .Site.Author.name | default .Site.Title }}