nicokaiser / hugo-theme-gallery

Gallery Theme for Hugo
https://nicokaiser.github.io/hugo-theme-gallery/
MIT License
336 stars 98 forks source link

Feat: Added conditional download options + Fix: Found workarround to backbutton lightbox behavior #67

Closed ErielCruz closed 4 months ago

ErielCruz commented 4 months ago

Hello!

I apologize in advance for a messy pull request with 1.5 features and 1 "Fix", however I wonder if this code could be useful for the repo.

The download functionality is conditional based on boolean values on the index.md files, meaning that only when true either individual images can be downloaded or all images can be downloaded with a button on the bottom of the gallery.

The "Fix" refers to a behavior that was annoying me that I saw many of users in mobile doing (friends visiting my site), when they were inside a photo in the lighbox gallery, they press the back button to go back to the gallery view, but instead they go back "two" pages before.

I understood this happens for how lightbox handles the "address bar" and history (not sure if these are the right terms) so I added a workaround to ensure back button presses (or backspace on pc) makes the user reloads the gallery they are in, instead of exiting it.

Again my apologies if this is messy code and not useful, just wanted to submit it in case it can be of any use.