Gallery Generator
This is a Jekyll plugin that generates galleries from directories full of images. It uses RMagick to create thumbnails.
This plugin is quite minimalist. It generates galleries with no pagination, no sub-galleries, and no descriptions. See my gallery for an example of what it looks like.
Usage
-
Install the jekyll-gallery-generator
gem, either by running gem install jekyll-gallery-generator
or by adding gem 'jekyll-gallery-generator'
to your Gemfile
and running bundle
.
-
Add jekyll-gallery-generator
to the plugins list in your _config.yml
:
plugins:
- jekyll-gallery-generator
- Copy your image directories into
jekyll-site/photos/
. Here's what my directory structure looks like:
$ ls jekyll-site/photos
best/ chile_trip/ japan_trip/
$ ls jekyll-site/photos/chile_trip
IMG_1039.JPG IMG_1046.JPG IMG_1057.JPG
- Run
jekyll build
and be patient. It can take a while to generate all the thumbnails on the first run. After that, you should have pretty pictures.
Dependencies
Install dependencies on OS X
brew install imagemagick rbenv
rbenv install 2.4.0
rbenv global 2.4.0
gem install rmagick exifr
Install dependencies on Ubuntu
apt install libmagick++-dev
gem install rmagick exifr
Configuration
This plugin reads several config options from _config.yml
. The following options are supported (default settings are shown):
gallery:
dir: photos
symlink: false
title: "Photos"
title_prefix: "Photos: "
sort_field: "date_time"
thumbnail_size:
x: 400
y: 400
galleries:
chile_trip:
best_image: IMG_1068.JPG
japan_trip:
best_image: IMG_0690.JPG
name: "日本の旅"
awesome_stuff:
best_image: snaileo_gonzales.jpg
sort_reverse: true
secret_stuff:
hidden: true
with_info:
info:
desc: "Gallery Description"
Overriding layouts
If you want to customize the templates used by this generator, copy gallery_index.html
and gallery_page.html
to your Jekyll site's _layouts
:
cp lib/gallery_index.html jekyll-site/_layouts/
cp lib/gallery_page.html jekyll-site/_layouts/