theNewDynamic / gohugo-theme-ananke

Ananke: A theme for Hugo Sites
https://gohugo-ananke-theme-demo.netlify.com/
MIT License
1.09k stars 1.12k forks source link

Resize featureimages #661

Open Productivix opened 8 months ago

Productivix commented 8 months ago

hi, I want to resize images in headers, so I modify a copy of the template file "site-header.html" with at first :

{{ $featured_image := partial "func/GetFeaturedImage.html" . }}
{{ if $featured_image }}
{{/*  this is a link to an image, not the image */}}
{{ $imagetaillee := resources.Get $featured_image  }} 
{{ $imagetaillee := $imagetaillee.Resize "600x" }}

line 5 is the last line here.

I get the error when I start the built : hugo server

`Start building sites … hugo v0.119.0-b84644c008e0dc2c4b67bd69cccf87a41a03937e+extended linux/amd64 BuildDate=2023-09-24T15:20:17Z VendorInfo=snap:0.119.0

ERROR render of "section" failed: "/home/william/logiciels/logiciels-windows/dev_RN-Node-GIT/site-prx-hugo/themes/ananke/layouts/_default/baseof.html:47:29": execute of template failed: template: _default/list.html:47:29: executing "header" at <partial "site-header.html" .>: error calling partial: "/home/william/logiciels/logiciels-windows/dev_RN-Node-GIT/site-prx-hugo/layouts/partials/site-header.html:5:33": execute of template failed: template: partials/site-header.html:5:33: executing "partials/site-header.html" at <$imagetaillee.Resize>: nil pointer evaluating resource.Resource.Resize Built in 140 ms Error: error building site: render: failed to render pages: render of "section" failed: "/home/william/logiciels/logiciels-windows/dev_RN-Node-GIT/site-prx-hugo/themes/ananke/layouts/_default/baseof.html:47:29": execute of template failed: template: _default/list.html:47:29: executing "header" at <partial "site-header.html" .>: error calling partial: "/home/william/logiciels/logiciels-windows/dev_RN-Node-GIT/site-prx-hugo/layouts/partials/site-header.html:5:33": execute of template failed: template: partials/site-header.html:5:33: executing "partials/site-header.html" at <$imagetaillee.Resize>: nil pointer evaluating resource.Resource.Resize ` I do not understand how to apply here the commands of the page https://gohugo.io/content-management/image-processing/

thanks for your help !