🚚 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
exampleSite/public/
exampleSite/resources/_gen/
TODO
.lighthouseci

View File

@ -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

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]
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/" },

View File

@ -1,14 +1,18 @@
{{ if .Params.showAuthor | default (.Site.Params.article.showAuthor | default true) }}
<div class="flex">
{{ with .Site.Author.image }}
{{ $authorImage := resources.Get . }}
{{ if $authorImage }}
{{ $authorImage := $authorImage.Fill "192x192" }}
<img
class="w-24 h-24 !mt-0 !mb-0 mr-4 rounded-full"
width="96"
height="96"
alt="Author"
src="{{ . | relURL }}"
src="{{ $authorImage.RelPermalink }}"
/>
{{ end }}
{{ end }}
<div class="place-self-center">
{{ with .Site.Author.name | markdownify | emojify }}
<div class="text-[0.6rem] leading-3 text-neutral-500 dark:text-neutral-400 uppercase">

View File

@ -5,7 +5,17 @@
>
<header class="flex flex-col items-center mb-3">
{{ 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 }}
<h1 class="text-4xl font-extrabold">
{{ .Site.Author.name | default .Site.Title }}