This is a plugin that makes it easy to include progressive image galleries in your Jekyll site. Jekyll-pig is made possible with minimagick and pig.js.
- jekyll-pig
to the plugins list in your site's _config.yml
Either add gem jekyll-pig
to your site's Gemfile
and run bundle install
or run gem install jekyll-pig
galleries
to your site's _config.yml
It should look like this:
galleries:
-
path: <path relative to site root>
name: <gallery-name>
-
<another gallery>
These lines tell jekyll-pig where to find your images and how to organize the generated output. <gallery-name>
shouldn't have any spaces.
_config.yml
and to your .gitignore
{% include <gallery-name>.html %}
in your pages and posts to include a the gallery identified by gallery-name
jekyll build
<site root>
├── _data
│ ├── <gallery-name>.json #data for a specific gallery (one for each gallery)
│ └── ...
├── _includes
│ ├── <gallery-name>.html #gallery include file (one for each gallery)
│ └── ...
├── assets
│ ├── html
│ │ ├── <gallery-name>
│ │ │ └── <filename>.html #an html page using layout: page for each image
│ │ └── ...
│ ├── img
│ │ ├── <gallery-name>
│ │ │ ├── 20
│ │ │ │ ├── <filename>.<ext> #each image resized into various size thumbnails
│ │ │ │ └── ...
│ │ │ ├── 100
│ │ │ │ └── ...
│ │ │ ├── 250
│ │ │ │ └── ...
│ │ │ ├── 500
│ │ │ │ └── ...
│ │ │ └── 1024
│ │ │ └── ...
│ │ └── ...
│ ├── js
│ │ ├── pig.min.js #js required for the gallery
│ │ └── ...
│ └── ...
└── ...
Wherever you {% include <gallery-name>.html %}
you will see a progressive image gallery.
Check out mine.
Each image in a gallery is linked to generated page for that image. The default jekyll theme lists all pages at the top of every page. To keep all your image pages from cluttering your page listing the generate pages include exclude: true
front matter. You can modify your header.html
include file like this:
{%- if my_page.title and my_page.exclude != true -%}
<a class="page-link" href="{{ my_page.url | relative_url }}">{{ my_page.title | escape }}</a>
{%- endif -%}
The above just prevents the page link from appearing if my_page.exclude
is true
.