jhvanderschee / hugocodex

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

image-gallery: make documentation example easier #26

Closed tanyabouman closed 7 months ago

tanyabouman commented 9 months ago

To use the image gallery, I copied and pasted from the image-gallery documentation page, and put my pictures in static/album. Then I got an error.

ERROR 2023/12/30 19:53:23 Rebuild failed: failed to render pages: render of "section" failed: "[]/layouts/section/gallery.html:61:7": execute of template failed at <partial "image-gallery" (dict "context" . "gallery_dir" "album")>: error calling partial: "[]/layouts/partials/image-gallery.html:11:10": execute of template failed at <readDir (print "/static" $dir)>: error calling readDir: failed to read directory "/staticalbum": open []/staticalbum: no such file or directory

I fixed the problem by adding a slash to the name of the directory.

{{ partial "image-gallery" (dict "context" . "gallery_dir" "/album") }}

This wasn't hard to solve, but I think having the leading slash in the documentation makes it easier to use.

jhvanderschee commented 7 months ago

Thank you for your contribution!