├── LICENSE ├── README.md └── jekyll ├── _layouts └── photo_set.html ├── berlin.md ├── images └── photos │ ├── berlin-1.jpg │ ├── berlin-2.jpg │ └── berlin-3.jpg └── photos.html /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2019 Michael Xander 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # jekyll-photos 2 | 3 | Dead simple solution to add a photo gallery to a Jekyll site. 4 | 5 | It’s easy to extend Jekyll with a small dose of creativity. Thanks to the template language Liquid, the only thing you often need is a new layout file. That’s what we use here as the foundation: 6 | 7 | * `/_layouts/photo_set.html`: The layout for each photo set, displaying every photo of a photo set. 8 | * `photos.html`: The overview page, displaying all photo sets. 9 | * `berlin.md`: An example photo set. 10 | * `/images/photos/`: The directory for all photos. You can change it in `/_layouts/photo_set.html` if you like. 11 | 12 | ## Demo 13 | 14 | *jekyll-photos* is unstyled, so that you can easily add your own CSS-flavor. Examples from my personal website: [Overview page](https://michaelxander.com/photos/), [a photo set](https://michaelxander.com/photos/new-york/). 15 | 16 | ## Installation 17 | 18 | Copy the files and folders of `/jekyll/` into the root directory of your Jekyll project. 19 | 20 | > **Note:** If you already have a layout called `photos` or `photos_set`, just rename the files of *jekyll-photos*. 21 | 22 | ## Usage 23 | 24 | Once everything is in place, you only need to add a new page with the following YAML front matter block: 25 | 26 | ```yaml 27 | --- 28 | layout: photo_set 29 | title: Berlin 30 | permalink: /berlin/ 31 | description: "An example photo gallery." 32 | 33 | photos: 34 | set: berlin 35 | size: 3 36 | --- 37 | ``` 38 | 39 | The important part is: 40 | 41 | ```yaml 42 | --- 43 | photos: 44 | set: berlin 45 | size: 3 46 | --- 47 | ``` 48 | 49 | `set` represents the photo set name and `size` the number of photos that the set contains. 50 | 51 | Now, rename the three photos to berlin-1.jpg, berlin-2.jpg, and berlin-3.jpg, and move them to `/images/photos/`. That’s it! 52 | 53 | > **Note:** If you want to use a different file format for your photos or images, you need to adjust `/_layouts/photo_set.html`, or make it configurable. You could also use [Jekyll File Exists](https://github.com/michaelx/jekyll_file_exists) to automatically detect what extension is available. 54 | 55 | ## Extensibility 56 | 57 | The goal of *jekyll-photos* is to show how easy it is to implement new site functions. It’s intentionally hold to the basics, which makes it easy to customize. For example, you could add photo categories or lazy load photos (like I do on my personal site). -------------------------------------------------------------------------------- /jekyll/_layouts/photo_set.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | --- 4 | 5 | {% assign num = page.photos.size %} 6 | 7 |

{{ page.title }}

8 | 15 |
16 | View All Photo Sets 17 |
-------------------------------------------------------------------------------- /jekyll/berlin.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: photo_set 3 | title: Berlin 4 | permalink: /berlin/ 5 | description: "An example photo gallery." 6 | 7 | photos: 8 | set: berlin 9 | size: 3 10 | --- -------------------------------------------------------------------------------- /jekyll/images/photos/berlin-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaelx/jekyll-photos/8e0119f7c0ea68af61f9610700155c2b8051e10e/jekyll/images/photos/berlin-1.jpg -------------------------------------------------------------------------------- /jekyll/images/photos/berlin-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaelx/jekyll-photos/8e0119f7c0ea68af61f9610700155c2b8051e10e/jekyll/images/photos/berlin-2.jpg -------------------------------------------------------------------------------- /jekyll/images/photos/berlin-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaelx/jekyll-photos/8e0119f7c0ea68af61f9610700155c2b8051e10e/jekyll/images/photos/berlin-3.jpg -------------------------------------------------------------------------------- /jekyll/photos.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Photos 4 | permalink: /photos/ 5 | description: "ENTER HERE" 6 | --- 7 | 8 |

Photo Sets

9 | --------------------------------------------------------------------------------