Skip to content

Commit

Permalink
Hugo image gallery: load image caption from EXIF data
Browse files Browse the repository at this point in the history
  • Loading branch information
christianspecht committed Jun 29, 2022
1 parent 5b255ec commit 425418f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion hugo-gallery-example/layouts/shortcodes/gallery.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
{{ with $image }}
{{ range . }}
{{ $resized := .Fill "150x115 q20" }}
<a href="{{ .Permalink }}" data-lightbox="x"><img src="{{ $resized.Permalink }}" /></a>
<a href="{{ .Permalink }}" data-lightbox="x" data-title="{{ with .Exif }}{{ .Tags.ImageDescription }}{{ end }}"><img src="{{ $resized.Permalink }}" /></a>
{{ end }}
{{ end }}
6 changes: 4 additions & 2 deletions hugo-gallery-example/readme.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
## Demo: building a Hugo page with a Lightbox 2 gallery

Blog post with more information: [Creating an image gallery with Hugo and Lightbox2](https://christianspecht.de/2020/08/10/creating-an-image-gallery-with-hugo-and-lightbox2/)
Blog posts with more information:
- [Creating an image gallery with Hugo and Lightbox2](https://christianspecht.de/2020/08/10/creating-an-image-gallery-with-hugo-and-lightbox2/)
- [Hugo/Lightbox image gallery: Loading image captions from EXIF data](https://christianspecht.de/2022/06/29/hugo-lightbox-image-gallery-loading-image-captions-from-exif-data/)

Tested with Hugo version 0.69.2.
Tested with Hugo version 0.69.2 and 0.91.2.

Run Hugo with `hugo server -D`

Expand Down

0 comments on commit 425418f

Please sign in to comment.