Builds / Jekyll
Use community-contributed packages and run custom code to extend your sites. All sites on CloudCannon support Jekyll plugins.
Add plugins to a site in a couple of ways:
.rbfiles to the
- Add plugins to your
Gemfilein the root folder
Here’s an example Gemfile:
source 'https://rubygems.org' gem 'jekyll', '3.1.6' group :jekyll_plugins do gem 'jekyll-sitemap', '0.10.0' end
It’s good practice to set your versions. Otherwise, Jekyll uses the latest version which could introduce breaking changes in future builds.
Caching bundle installs
Installing your gems can take quite some time, to save time on consecutive builds CloudCannon does the following:
- Installs your gem to a local folder
- Caches that folder based on your Gemfile.lock
- When no local gems are found, build your site using the cached installs from your previous builds
To disable this feature, go to Site Settings / Build.
Older sites on CloudCannon will have this caching disabled to prevent changes to their build environment. Enabling this can greatly improve editing experience.
The cloudcannon-jekyll gem
In order to optimise the editing interfaces for your site, CloudCannon injects an open source plugin called
cloudcannon-jekyll before building your site.
This generates JSON files with titles, collections, build settings and other metadata that CloudCannon displays for your editors.
By default, data files are not included in the generated output. Including this would enable you to populate select and multiselect inputs from data files.
To include all
data, add the following to your
cloudcannon: data: true
Include only select
data with specific keys:
cloudcannon: data: authors: true offices: true
Although not necessary, if you would like to generate the details file locally, add the following to your
gem 'cloudcannon-jekyll', :group => :jekyll_plugins
safe: truedisables all plugins, including
cloudcannon-jekyll. This is not recommended as it degrades the editing experience.