Transition to Hugo Image Processing (#173)
* Update layout to use Hugo Image Processing. Created shortcode rimg that uses the srcset attribute to display responsive images. * Copy Static images to assets folder. * Add image processing to missing components + Update examples * Fix rendering in https://themes.gohugo.io/ Co-authored-by: Emruz Hossain <emruz@appscode.com>
This commit is contained in:
parent
ba1d6014d9
commit
a2b3c7fda2
53 changed files with 352 additions and 75 deletions
|
@ -2,11 +2,14 @@
|
|||
{{ if (index site.Data site.Language.Lang).author }}
|
||||
{{ $author = (index site.Data site.Language.Lang).author }}
|
||||
{{ end }}
|
||||
{{ $authorImage:= "/assets/images/default-avatar.png" }}
|
||||
|
||||
{{/* default author image */}}
|
||||
{{ $authorImage:= "/images/default-avatar.png" }}
|
||||
{{ if $author.image }}
|
||||
{{ $authorImage = $author.image }}
|
||||
{{ end }}
|
||||
|
||||
{{/* if author image is provided in author's data, then use that */}}
|
||||
{{ if eq (printf "%T" .Params.author ) "maps.Params" }}
|
||||
{{ with .Params.author }}
|
||||
{{ if .image }}
|
||||
|
@ -14,4 +17,13 @@
|
|||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ return $authorImage }}
|
||||
|
||||
{{/* apply image processing. don't use "Fit" in svg because its not supported */}}
|
||||
{{ $authorImage:= resources.Get $authorImage}}
|
||||
{{ if and $authorImage (ne $authorImage.MediaType.SubType "svg") }}
|
||||
{{ $authorImage := $authorImage.Fit "120x120" }}
|
||||
{{ end }}
|
||||
|
||||
{{/* return the author image link */}}
|
||||
{{ return $authorImage.RelPermalink }}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue