jhvanderschee / hugocodex

A website for front-end developers who want to learn Hugo.
http://hugocodex.org
23 stars 11 forks source link

image-gallery shortcode issue #7

Closed SvenMazet closed 2 years ago

SvenMazet commented 2 years ago

I'm getting this error when using the shortcode image-gallery.html: failed to render shortcode "image-gallery": failed to process shortcode: "/home/<user>/<hugo-folder>/<site-name>/layouts/shortcodes/image-gallery.html:16:25": execute of template failed at <$image.Fit>: nil pointer evaluating resource.Resource.Fit

this comes up with a Hugo server command, but also a similar error when I just start the Hugo server command to test a page.

I followed the instructions on the site, but it's not working.

Also, when I just use the image-gallery template, and the code to render the gallery on my page, it doesn't throw an error, but it also won't generate a gallery.

I'm probably doing something wrong, but any help would be appreciated.

mogita commented 2 years ago

HI @SvenMazet , I've just encourntered this issue and found a solution.

There are several things one needs to look out when using this shor-code:

Hope this helps.

SvenMazet commented 2 years ago

Hi there,

That did do the trick, adding the assetDir to my config! Tnx for the tip!

With kind regards, Sven Van: Wang Yun @.> Verzonden: vrijdag 26 augustus 2022 11:33 Aan: jhvanderschee/hugocodex @.> CC: SvenMazet @.>; Mention @.> Onderwerp: Re: [jhvanderschee/hugocodex] image-gallery shortcode issue (Issue #7)

HI @SvenMazethttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FSvenMazet&data=05%7C01%7C%7C0ae2bee0ee8c4a24b3c108da8745fcfc%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637971031910265614%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=LS88uYLil4KPm9ks8oX1D2acXCLT3qgMrAcCuSfaYHA%3D&reserved=0 , I've just encourntered this issue and found a solution.

There are several things one needs to look out when using this shor-code:

Hope this helps.

- Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjhvanderschee%2Fhugocodex%2Fissues%2F7%23issuecomment-1228278282&data=05%7C01%7C%7C0ae2bee0ee8c4a24b3c108da8745fcfc%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637971031910265614%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=DIwxm1qfDqjaoW5lZCaVc%2FgC0g1ia51tQqxCPUpV9tc%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAQMAALPHD3BPDBVXRN67P33V3CFNJANCNFSM53KETS5A&data=05%7C01%7C%7C0ae2bee0ee8c4a24b3c108da8745fcfc%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637971031910265614%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=MWcVf5%2FXPOProoNEJTiHi8316K8wQfe66AvCk7LP8c8%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.**@.>>

northben commented 11 months ago

I ran into the same problem. I noticed that the assets directory is hardcoded in the shortcode file. And on MacOS, make sure there are no .DS_Store files in the image directory.

find . -name .DS_Store -delete