Skip to content

Commit

Permalink
Allow setting GIFS as author image (hugo-toha#394)
Browse files Browse the repository at this point in the history
Co-authored-by: Emruz Hossain <[email protected]>
  • Loading branch information
Rihoj and hossainemruz committed Aug 10, 2021
1 parent 8c7ae86 commit fc3b483
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions layouts/partials/helpers/get-author-image.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
{{ end }}
{{ end }}

{{/* apply image processing. don't use "Fit" in svg because its not supported */}}
{{/* apply image processing. don't use "Fit" in svg or gif because its not supported */}}
{{ $authorImage:= resources.Get $authorImage}}
{{ if and $authorImage (ne $authorImage.MediaType.SubType "svg") }}

{{ if and $authorImage (and (ne $authorImage.MediaType.SubType "svg") ( ne $authorImage.MediaType.SubType "gif")) }}
{{ $authorImage = $authorImage.Fit "120x120" }}
{{ end }}

{{/* return the author image link */}}
{{ return $authorImage.RelPermalink }}

5 changes: 4 additions & 1 deletion layouts/partials/sections/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@
{{ $authorImage = $author.image }}
{{ end }}
{{ $authorImage := resources.Get $authorImage }}
{{ $authorImage = $authorImage.Fit "148x148" }}

{{/* apply image processing. don't use "Fit" in svg or gif because its not supported */}}
{{ if and $authorImage (and (ne $authorImage.MediaType.SubType "svg") ( ne $authorImage.MediaType.SubType "gif")) }}
{{ $authorImage = $authorImage.Fit "148x148" }}
{{ end }}
{{/* get file that matches the filename as specified as src="" in shortcode */}}
{{ $src := resources.Get $backgroundImage }}

Expand Down

0 comments on commit fc3b483

Please sign in to comment.