Coder Social home page Coder Social logo

jekyll-photos's Introduction

jekyll-photos

Dead simple solution to add a photo gallery to a Jekyll site.

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:

  • /_layouts/photo_set.html: The layout for each photo set, displaying every photo of a photo set.
  • photos.html: The overview page, displaying all photo sets.
  • berlin.md: An example photo set.
  • /images/photos/: The directory for all photos. You can change it in /_layouts/photo_set.html if you like.

Demo

jekyll-photos is unstyled, so that you can easily add your own CSS-flavor. Examples from my personal website: Overview page, a photo set.

Installation

Copy the files and folders of /jekyll/ into the root directory of your Jekyll project.

Note: If you already have a layout called photos or photos_set, just rename the files of jekyll-photos.

Usage

Once everything is in place, you only need to add a new page with the following YAML front matter block:

---
layout: photo_set
title: Berlin
permalink: /berlin/
description: "An example photo gallery."

photos:
    set: berlin
    size: 3
---

The important part is:

---
photos:
    set: berlin
    size: 3
---

set represents the photo set name and size the number of photos that the set contains.

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!

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 to automatically detect what extension is available.

Extensibility

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-photos's People

Contributors

michaelx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.