Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow empty galleries #42

Open
nicokaiser opened this issue Feb 4, 2024 · 2 comments
Open

Allow empty galleries #42

nicokaiser opened this issue Feb 4, 2024 · 2 comments

Comments

@nicokaiser
Copy link
Owner

No description provided.

@pwab
Copy link

pwab commented Mar 19, 2024

Just in case anyone rans into the same error and because it is not obvious that it is tracked by this issue:

Error: error building site: render: failed to render pages: render of "home" failed: "[...]\layouts_default\home.html:3:5": execute of template failed: template: _default/home.html:3:5: executing "main" at <partial "featured.html" .>: error calling partial: "[...]\layouts\partials\featured.html:12:37": execute of template failed: template: partials/featured.html:12:37: executing "partials/featured.html" at <$gallery.imageCount>: can't evaluate field imageCount in type string

This is due to not having images inside your content folder. It is not mentioned in the repositories README but in the README of the exampleSite to run pull-images.sh. After downloading the images the error disappears.

If anyone is trying to run the script on a Windows machine: I had no luck with wget because it has no alias in PowerShell and also I wasn't able to get it running in the WSL (curl works). So I converted it into native PowerShell (Set-ItemProperty did not work - I have to investigate it later on):

# Save to the root folder as: pull-images.ps1
# Call by: .\pull-images.ps1

# Home
Invoke-WebRequest -Uri "https://unsplash.com/photos/wRuhOOaG-Z4/download?&force=true&w=1920" -OutFile "./content/wRuhOOaG-Z4.jpg"

# Animals
Invoke-WebRequest -Uri "https://unsplash.com/photos/UC1pzyJFyvs/download?&force=true&w=1920" -OutFile "./content/animals/UC1pzyJFyvs.jpg"

# Animals/Cats
Invoke-WebRequest -Uri "https://unsplash.com/photos/gKXKBY-C-Dk/download?force=true&w=1920" -OutFile "./content/animals/cats/gKXKBY-C-Dk.jpg"
Invoke-WebRequest -Uri "https://unsplash.com/photos/75715CVEJhI/download?force=true&w=1920" -OutFile "./content/animals/cats/75715CVEJhI.jpg"
Invoke-WebRequest -Uri "https://unsplash.com/photos/mJaD10XeD7w/download?&force=true&w=1920" -OutFile "./content/animals/cats/mJaD10XeD7w.jpg"
Invoke-WebRequest -Uri "https://unsplash.com/photos/CEx86maLUSc/download?&force=true&w=1920" -OutFile "./content/animals/cats/CEx86maLUSc.jpg"
Invoke-WebRequest -Uri "https://unsplash.com/photos/yMSecCHsIBc/download?&force=true&w=1920" -OutFile "./content/animals/cats/yMSecCHsIBc.jpg"
Invoke-WebRequest -Uri "https://unsplash.com/photos/rW-I87aPY5Y/download?&force=true&w=1920" -OutFile "./content/animals/cats/rW-I87aPY5Y.jpg"
Invoke-WebRequest -Uri "https://unsplash.com/photos/p6yH8VmGqxo/download?&force=true&w=1920" -OutFile "./content/animals/cats/p6yH8VmGqxo.jpg"
Invoke-WebRequest -Uri "https://unsplash.com/photos/LEpfefQf4rU/download?&force=true&w=1920" -OutFile "./content/animals/cats/LEpfefQf4rU.jpg"
Invoke-WebRequest -Uri "https://unsplash.com/photos/nKC772R_qog/download?&force=true&w=1920" -OutFile "./content/animals/cats/nKC772R_qog.jpg"

# Set ImageDescription for Cats
# Not sure how this works on Windows
#Set-ItemProperty -Path "./content/animals/cats/mJaD10XeD7w.jpg" -Name ImageDescription -Value "Brown tabby cat on white stairs by Alexander London"
#Set-ItemProperty -Path "./content/animals/cats/75715CVEJhI.jpg" -Name ImageDescription -Value "Selective focus photography of orange and white cat on brown table by Amber Kipp"

# Animals/Dogs
Invoke-WebRequest -Uri "https://unsplash.com/photos/Sg3XwuEpybU/download?&force=true&w=1920" -OutFile "./content/animals/dogs/Sg3XwuEpybU.jpg"
Invoke-WebRequest -Uri "https://unsplash.com/photos/Mv9hjnEUHR4/download?&force=true&w=1920" -OutFile "./content/animals/dogs/Mv9hjnEUHR4.jpg"
Invoke-WebRequest -Uri "https://unsplash.com/photos/2l0CWTpcChI/download?&force=true&w=1920" -OutFile "./content/animals/dogs/2l0CWTpcChI.jpg"
Invoke-WebRequest -Uri "https://unsplash.com/photos/WX4i1Jq_o0Y/download?&force=true&w=1920" -OutFile "./content/animals/dogs/WX4i1Jq_o0Y.jpg"

# Fashion & Beauty
Invoke-WebRequest -Uri "https://unsplash.com/photos/FkxXePJJH5g/download?force=true&w=1920" -OutFile "./content/fashion-beauty/FkxXePJJH5g.jpg"
Invoke-WebRequest -Uri "https://unsplash.com/photos/63obHScZWZw/download?&force=true&w=1920" -OutFile "./content/fashion-beauty/63obHScZWZw.jpg"
Invoke-WebRequest -Uri "https://unsplash.com/photos/7gqnlnCTvlg/download?&force=true&w=1920" -OutFile "./content/fashion-beauty/7gqnlnCTvlg.jpg"
Invoke-WebRequest -Uri "https://unsplash.com/photos/V94CguEmeos/download?&force=true&w=1920" -OutFile "./content/fashion-beauty/V94CguEmeos.jpg"

# Nature
Invoke-WebRequest -Uri "https://unsplash.com/photos/ZS_XuDZmxpM/download?&force=true&w=1920" -OutFile "./content/nature/ZS_XuDZmxpM.jpg"
Invoke-WebRequest -Uri "https://unsplash.com/photos/U7BG3FOT5r8/download?&force=true&w=1920" -OutFile "./content/nature/U7BG3FOT5r8.jpg"
Invoke-WebRequest -Uri "https://unsplash.com/photos/TUzsO59UFpo/download?&force=true&w=1920" -OutFile "./content/nature/TUzsO59UFpo.jpg"
Invoke-WebRequest -Uri "https://unsplash.com/photos/P45gR9kH0SM/download?&force=true&w=1920" -OutFile "./content/nature/P45gR9kH0SM.jpg"
Invoke-WebRequest -Uri "https://unsplash.com/photos/k_PbdrEs79g/download?force=true&w=1920" -OutFile "./content/nature/k_PbdrEs79g.jpg"
Invoke-WebRequest -Uri "https://unsplash.com/photos/4f8u5mFGKjw/download?&force=true&w=1920" -OutFile "./content/nature/4f8u5mFGKjw.jpg"
Invoke-WebRequest -Uri "https://unsplash.com/photos/f_C_lFxqThI/download?&force=true&w=1920" -OutFile "./content/nature/f_C_lFxqThI.jpg"
Invoke-WebRequest -Uri "https://unsplash.com/photos/x7CyIC2jUaE/download?&force=true&w=1920" -OutFile "./content/nature/x7CyIC2jUaE.jpg"
Invoke-WebRequest -Uri "https://unsplash.com/photos/RuaRTaKi-D4/download?force=true&w=1920" -OutFile "./content/nature/RuaRTaKi-D4.jpg"

# Private
Invoke-WebRequest -Uri "https://unsplash.com/photos/gRknIewfaBs/download?force=true&w=1920" -OutFile "./content/private/gRknIewfaBs.jpg"
Invoke-WebRequest -Uri "https://unsplash.com/photos/QQ0naV2n-mg/download?force=true&w=1920" -OutFile "./content/private/QQ0naV2n-mg.jpg"
Invoke-WebRequest -Uri "https://unsplash.com/photos/_lQgFjsTgEs/download?force=true&w=1920" -OutFile "./content/private/_lQgFjsTgEs.jpg"
Invoke-WebRequest -Uri "https://unsplash.com/photos/7pYqHNp37Pg/download?force=true&w=1920" -OutFile "./content/private/7pYqHNp37Pg.jpg"
Invoke-WebRequest -Uri "https://unsplash.com/photos/6dH1__uRYtg/download?force=true&w=1920" -OutFile "./content/private/6dH1__uRYtg.jpg"
Invoke-WebRequest -Uri "https://unsplash.com/photos/t2WImwH1Fa0/download?force=true&w=1920" -OutFile "./content/private/t2WImwH1Fa0.jpg"

# Featured
Invoke-WebRequest -Uri "https://unsplash.com/photos/fcwZsjyqp0s/download?force=true&w=1920" -OutFile "./content/featured-album/fcwZsjyqp0s.jpg"
Invoke-WebRequest -Uri "https://unsplash.com/photos/IFlBNNOLHUo/download?force=true&w=1920" -OutFile "./content/featured-album/IFlBNNOLHUo.jpg"
Invoke-WebRequest -Uri "https://unsplash.com/photos/pjszS6Q2g_Y/download?force=true&w=1920" -OutFile "./content/featured-album/pjszS6Q2g_Y.jpg"

@nicokaiser by the way: nice theme! 👍

@nicokaiser
Copy link
Owner Author

Nice catch! I added a fix which at least avoids a crash when the featured gallery is empty.
I did not want to include example images in the main repository, but this also prevents automatic builds of the example site from the original theme repository...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants