jekyll-image-cache

jekyll-image-cache

🔌 A Jekyll plugin that updates image links to serve through https://images.weserv.nl/

jekyll-image-cache

A Jekyll plugin that updates specific image links to be served and resized through https://images.weserv.nl/.

Installation

  1. Add the following to your site's Gemfile:

    gem 'jekyll-image-cache'
    
  2. add the following to your site's _config.yml:

    plugins:
      - jekyll-image-cache
    

    Note: if jekyll --version is less than 3.5 use:

    gems:
      - jekyll-image-cache
    
  3. In your terminal, execute:

    bundle
    
  4. (re)start your Jekyll server with:

    jekyll serve
    

Usage

Add the u-photo class to any image you wish to be cached and resized (width of 640px) on https://images.weserv.nl/, either using Markdown syntax:

![Image alt](https://example.com/images/photo.jpg){:class="u-photo"}

... or HTML syntax:

<img src="https://example.com/images/photo.jpg" alt="Image alt" class="u-photo">

The resulting images will be rendered with a src URL of: //images.weserv.nl/?url=example.com/images/photo.jpg&w=640

💡 Tip: Note that the github-pages gem runs in safe mode and only allows a defined set of plugins. To use this gem in GitHub Pages, you need to build your site locally or use a CI (e.g. Github Workflow) and deploy to your gh-pages branch. Click here for more information.


TODO

  • Make caching service configurable
  • Make image sizing etc options configurable
jekyll logo

Want a Jekyll website built?

Hire a Jekyll developer