From 1b9b660abe8f16df9b55817b8a1eb5e9e81f20af Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Tue, 11 Jan 2022 12:29:21 +1100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=9A=20Move=20author=20image=20to=20ass?= =?UTF-8?q?ets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + CHANGELOG.md | 1 + exampleSite/{static/img => assets}/author.jpg | Bin exampleSite/config/_default/languages.en.toml | 2 +- layouts/partials/author.html | 18 +++++++++++------- layouts/partials/home/profile.html | 12 +++++++++++- 6 files changed, 25 insertions(+), 9 deletions(-) rename exampleSite/{static/img => assets}/author.jpg (100%) diff --git a/.gitignore b/.gitignore index 7b2b1e95..7b48f439 100644 --- a/.gitignore +++ b/.gitignore @@ -143,5 +143,6 @@ hugo.linux # End of https://www.toptal.com/developers/gitignore/api/hugo exampleSite/public/ +exampleSite/resources/_gen/ TODO .lighthouseci diff --git a/CHANGELOG.md b/CHANGELOG.md index fd4eb504..33717a37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Changed - Upgrade to Tailwind v3.0.12 +- Author images are now Hugo assets ## [1.6.2] - 2022-01-07 diff --git a/exampleSite/static/img/author.jpg b/exampleSite/assets/author.jpg similarity index 100% rename from exampleSite/static/img/author.jpg rename to exampleSite/assets/author.jpg diff --git a/exampleSite/config/_default/languages.en.toml b/exampleSite/config/_default/languages.en.toml index 7955ab5d..f3e159b5 100644 --- a/exampleSite/config/_default/languages.en.toml +++ b/exampleSite/config/_default/languages.en.toml @@ -11,7 +11,7 @@ dateFormat = "2 January 2006" [author] 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:" links = [ { twitter = "https://twitter.com/" }, diff --git a/layouts/partials/author.html b/layouts/partials/author.html index 6811058a..8655e05b 100644 --- a/layouts/partials/author.html +++ b/layouts/partials/author.html @@ -1,13 +1,17 @@ {{ if .Params.showAuthor | default (.Site.Params.article.showAuthor | default true) }}
{{ with .Site.Author.image }} - Author + {{ $authorImage := resources.Get . }} + {{ if $authorImage }} + {{ $authorImage := $authorImage.Fill "192x192" }} + Author + {{ end }} {{ end }}
{{ with .Site.Author.name | markdownify | emojify }} diff --git a/layouts/partials/home/profile.html b/layouts/partials/home/profile.html index 905525cd..ffa765fc 100644 --- a/layouts/partials/home/profile.html +++ b/layouts/partials/home/profile.html @@ -5,7 +5,17 @@ >
{{ with .Site.Author.image }} - Author + {{ $authorImage := resources.Get . }} + {{ if $authorImage }} + {{ $authorImage := $authorImage.Fill "288x288" }} + Author + {{ end }} {{ end }}

{{ .Site.Author.name | default .Site.Title }}