Capella Jekyll documentation
Pictures
How to add pictures to Capella: plain files, optional smaller WebP copies, the stand-ins for the demo's photos, cropping and focus.
Pictures live in assets/img/. A picture is a plain file, and you point to it with its path, such as /assets/img/golden-hour.jpg. That’s all you need. JPG, PNG and WebP all work.
Cropping
Every photo sits in a frame with a fixed shape, and the photo is cropped to fill it. A tall or wide photo never stretches, and its own size never matters for the layout. The shapes are:
| Where | Shape |
|---|---|
| Post list rows | Portrait (4 to 5) |
| The featured row, and the single featured post | Square |
| The grid list, related posts and the 404 page | Wide (16 to 9) |
| The wide card in the mixed list | A wide strip |
| The photo on top of a post | A wide banner |
| The hero portrait | Tall (3 to 4) |
| The Instagram box | Square |
Because a photo is cropped, choose which part stays in view with image_position:
image: /assets/img/demo/golden-hour.webp
image_position: "50% 20%"
The two numbers are how far across and how far down the focus point is. "50% 20%" keeps the upper part of the photo. A word such as top works too. The same position setting is on the hero’s image.
Faster on phones: smaller copies
For a sharp picture on every screen without sending a big file to a phone, add smaller WebP copies next to the main file, with the width at the end of the name:
assets/img/golden-hour.webp
assets/img/golden-hour-480.webp
assets/img/golden-hour-720.webp
assets/img/golden-hour-960.webp
Then write the path of the main file, as always. Capella finds the copies by itself and lets each browser download the smallest one that’s sharp enough. The main file counts as the largest size, so make it about 1600 pixels wide.
- The widths Capella looks for are
capella.image_widthsin_config.yml, which is[480, 720, 960, 1600]. The last number is the main file. You don’t have to make every copy: any that are missing are skipped. - The copies must be WebP and named exactly
<name>-<width>.webp, in the same folder as the main file. - Without copies, the one file is used at every size. The site still works.
Capella doesn’t include an image tool, so export the sizes with any editor. Squoosh is free and runs in your browser. Save as WebP at around quality 80.
Photos load lazily, except the biggest one near the top of a page, which loads first. The hero and the photo on top of a post do this by themselves. In a list block, set eager: true if its first photo is the biggest on the page.
The pictures that aren’t in your download
The live demo uses photos we can’t pass on. Your download has plain stand-ins with the same file names and sizes, so the site builds and looks finished from the first minute: a pale panel with a photo mark. The hero is a head-and-shoulders silhouette, and og.jpg is a pale card.
All of them are in assets/img/demo/. Replace them one at a time, either by saving your picture over the stand-in with the same name, or by adding your own file and changing the path in your page or post. When you’ve replaced everything you use, you can delete the folder.
| Stand-in files | Used for |
|---|---|
hero-capella*.webp |
The hero portrait on the home and About pages |
The sample posts’ photos, such as golden-hour*.webp and packing-light*.webp |
Sample posts |
instagram-1.webp to instagram-6.webp, instagram-avatar.webp |
The Instagram box, the author box and the quote |
sponsor-backpacks.webp, sponsor-santorini*.webp |
The two sponsor cards |
og.jpg |
The picture shown when a page is shared (1200 × 630) |
The hero portrait
The portrait hero looks best with a cut-out: you, with a transparent background, about 1600 pixels wide, saved as WebP (which keeps transparency). A photo with its own background shows as a rectangle. If you don’t have a cut-out, use variant: text or variant: centered for a hero with no picture. See Pages and blocks.
Photos in a post
The post’s main photo is image in its front matter. Inside the text, use a Markdown picture, or figure.html for a caption or two photos side by side. See Writing posts. Always write an image_alt or alt that says what’s in the picture.
Avatars
The author, quote and Instagram avatars are small round pictures. A small file is enough, about 160 pixels wide. They use the one file you give, with no smaller copies.
The sharing image and favicon
Set the sharing image under defaults: in _config.yml (image: /assets/img/demo/og.jpg) and make it 1200 × 630 pixels. Replace assets/favicon.svg for the tab icon. See SEO.