Spica Jekyll documentation
Things you can put in a post
Add a gallery, carousel, video, captioned figure, note or button to a Spica post or page with one line, with every option and a snippet for each.
Plain Markdown covers most of a post: headings, lists, quotes, tables, code and footnotes. For a few more things, Spica has small pieces you drop in with one line: a gallery, a video, a figure, a note and a button. The live /elements/ page shows every piece with a snippet to copy. The same page is in your copy at /elements/ when you run the site.
Put the line in the Markdown text of a post, a project or a page, where you want the piece to appear. Leave a blank line above and below it.
Gallery
A gallery shows pictures as square thumbnails, or as a strip you swipe. Clicking one opens it large. There are three ways to give it pictures.
A list in the page’s front matter. Good for a project, or any post that keeps its pictures with its other settings:
---
title: "Tea label set"
gallery:
- /assets/img/projects/tea-label-set-1.webp
- /assets/img/projects/tea-label-set-2.webp
---
{% include gallery.html images=page.gallery columns=3 %}
A folder. Every .webp, .jpg and .png in that folder goes in:
{% include gallery.html folder="/assets/img/trip" %}
A short list written out, separated by commas:
{% include gallery.html images="/assets/img/a.webp, /assets/img/b.webp" alts="A harbor|A market" %}
| Option | What it does |
|---|---|
images |
A list from the front matter, or picture paths separated by commas. |
folder |
A folder on your site, such as /assets/img/trip. The smaller copies named -480 and -960 are left out, because the page uses them by itself. See Pictures. |
columns |
How many pictures across: 2, 3 (the default) or 4. Phones show 2. |
style |
grid (square thumbnails, the default) or carousel (one row you swipe or scroll). |
alts |
A description for each picture, separated by a bar: `alts=“A harbor |
wide |
true makes the gallery run the full width of the post. |
For a carousel:
{% include gallery.html folder="/assets/img/posts" style="carousel" %}
The carousel snaps to each picture and moves without JavaScript. Pictures in a folder are listed in the order of their file names, so name them trip-01.webp, trip-02.webp and so on to control the order.
If you want a description for each picture from the front matter, list each one with a src and an alt:
gallery:
- src: /assets/img/projects/tea-label-set-1.webp
alt: The front labels in a row
- src: /assets/img/projects/tea-label-set-2.webp
alt: The back labels with tasting notes
The picture viewer
Clicking a picture opens it large over the page, with Previous, Next and Close buttons. The arrow keys move between pictures, and Esc or a click outside the picture closes it. The picture’s description (alts) shows under it. Without JavaScript, each thumbnail is a plain link to the full picture.
Video
A video that loads only when the reader asks for it:
{% include video.html id="VIDEO_ID" title="How the backup runs" %}
Until the click, the reader sees a 16:9 picture with a play button, and nothing is loaded from YouTube or Vimeo. Without JavaScript it is a plain link to the video.
| Option | What it does |
|---|---|
id |
The video’s ID (required). For YouTube, the part after v= in its address. For Vimeo, the number. |
title |
What the video is about. It shows on the picture and screen readers read it. |
provider |
youtube (the default, through youtube-nocookie.com) or vimeo. |
poster |
A picture on your own site to show before the click. Without it, you get a plain tinted panel. |
wide |
true makes the video run the full width of the post. |
{% include video.html provider="vimeo" id="123456789" title="Studio tour" poster="/assets/img/studio.webp" %}
Figure
A picture with a caption, cropped to a fixed shape so the page doesn’t jump while it loads:
{% include figure.html src="/assets/img/my-photo.webp" alt="What the picture shows" caption="Where and when" %}
| Option | What it does |
|---|---|
src |
The picture (required). Smaller copies beside it are used on phones. |
alt |
What the picture shows (required). Use "" for a picture that is only decoration. |
caption |
A line under the picture. Markdown works: *italic* and [links](/about/). |
wide |
true makes the picture run past the text column, to the full width of the post. |
ratio |
The shape of the frame: card (3 by 2, the default), wide (16 by 9), square or tall (4 by 5). The picture is cropped to fit. |
position |
Which part stays in view when it’s cropped, such as "50% 20%" or top. |
{% include figure.html src="/assets/img/posts/using-white-space.webp" alt="Abstract shapes" caption="A wide figure, 16:9." wide=true ratio="wide" %}
A plain Markdown picture () fills the column and keeps its own shape. Use figure.html when you want a caption or a fixed shape.
A note on wide: in a post that has a contents list beside the text (three or more headings, on a wide screen), there’s no room to break out, so wide pieces keep to the text column. On other pages and on phones, they use the full width.
Note
A colored box for something the reader shouldn’t miss:
{% include note.html type="tip" text="Press **Esc** to close the picture." %}
| Option | What it does |
|---|---|
type |
note (the default), tip or warning. |
text |
What the box says. Markdown works in it. |
For text with more than one line, put it in a variable first:
{% capture my_text %}First line. Second line.{% endcapture %}
{% include note.html text=my_text %}
You can also make the same box with plain Markdown. Write a paragraph, then a line with the class directly under it:
A plain paragraph made into a tip.
{: .tip}
The classes are .note, .tip and .warning.
Button
A link that looks like a button:
{% include button.html label="Download the file" url="/files/notes.pdf" style="accent" %}
| Option | What it does |
|---|---|
label |
The words on the button (required). |
url |
Where it goes (required). A path on your site, such as /about/, or a full address. |
style |
accent (the accent-colored fill), dark (the default), outline or text (a plain link with a soft hover). |
icon |
An icon name from _includes/icons/, shown after the label. arrow-up-right suits a link to another site. |
{% include button.html label="Visit the site" url="https://example.com/" style="outline" icon="arrow-up-right" %}
Markdown extras
Spica uses kramdown with GitHub-style Markdown. Besides the usual, you can write:
~~strikethrough~~,<mark>marked text</mark>and<kbd>Ctrl</kbd>for a key.- Task lists:
- [x] Doneand- [ ] Still to do. - Tables with pipes. A table wider than the column scrolls inside itself on a phone.
- Footnotes: put
[^1]in the text and[^1]: The note.on its own line. - Code with a language after the three backticks, such as
javascriptorcss. Rouge colors it in light and dark mode. - A class on any paragraph with
{: .class}on the line under it, as for notes above.
Using these on a page
All of these also work on pages such as About, and in projects. Two things differ on a page that isn’t a post:
- The Copy button on code blocks is added to posts by the post layout. On a page, add
{% include copy-code.html %}at the end of the page’s text, as the Elements page does. - A plain page needs
css: [prose, page]in its front matter so the text and these pieces are styled. See Files and folders.