Khalid / Templates / Margin

Personal journal template. Margin

One writer's personal site, with a short introduction, a sign-up band and essays as rows, where each essay's date, reading time and topic, the byline and the essay's own footnotes sit in a ruled margin beside the text.

Free and open source, built into Khalid.

Start a blog
khalid init blog --template margin
Run it where you want the blog's folder. It asks for the blog's address, then builds it.

The home page, a post and a phone.

The home page of the Margin template
The home page
A post in the Margin template
A post
The home page of the Margin template on a phone
On a phone

What it shows.

Margin is a template for one writer's personal site. It has a short introduction, a sign-up and your essays. On a wide screen every page is a column of text with a margin beside it, split by one ruled line. The small things go in the margin: who you are, the notes beside the sign-up, each essay's date and topic, and the essay's own footnotes.

What the front page shows

  1. Introduction: your site's name large and your tagline, or the front page's own intro when it has one. Your photo, name and role sit in the margin.
  2. Sign-up band between two hairlines, with its notes in the margin.
  3. Essays: the newest leads with its picture across the column and the margin. Each essay is a row with its title and summary in the text, and its date, reading time and topic in the margin.
  4. Numbered page links when there are more essays.

When [[reader.home_sections]] lists sections, they take the place of the essays, each as the same rows.

What a post shows

  1. The topic as a small label, the title and the description as a dek. The byline, the date and the reading time sit in the margin beside them.
  2. The lead picture across the column and the margin.
  3. The essay in a column of about 70 characters a line, with its footnotes in the margin.
  4. The tags, the share links and the author box, then the newsletter form when your site takes sign-ups.
  5. Related essays as rows with their own margin notes.

With contents = "side-end" or "side-start", the contents list takes the margin and the notes follow the essay.

Its options.

Set any of these under [template.options]. An option you leave out takes the default shown.

Option Default What it changes
writer empty The slug of the author in the margin of the introduction. Empty shows the newest essay's author.
tagline none The short introduction under your name on the front page.
letter_notes none Up to three short notes in the margin beside the sign-up.
logo false The header shows your logo from [brand] logo in place of the site's name.
breadcrumbs false Each page shows the trail of links from the home page to it.
dek true A post shows its description under its title.
updated_note false An updated post says why it was updated, from its updated_note.
cards "text" The shape of the cards on shared pages such as search: image, text, row, compact or ranked.
pagination "numbered" numbered links to each page near this one; pages shows only newer and older.
related_count 3 How many related essays show, from 3 to 10.
contents "inline-folded" Where a long post's contents go: inline, inline-folded, side-end, side-start or none.
header_search "button" What the header's search does on a served site: button, link or none.
contents_numbers "none" How the contents are numbered: none, numbered or nested.
share "end" Where a post shows its share links: none, top, end or both.
share_networks ["bluesky", "email"] The networks the share links go to, in order.
newsletter "both" Where the newsletter form shows on a site that takes sign-ups: none, post, home or both.
cta_band "none" Where a band with your call to action shows as well: none, post, home or both.
cta_button false The header shows your call to action as a button.
topic_tabs false Tabs on the front page, one per topic, each with its four newest posts.
video_section false A row of the newest posts with a video.
podcast_section false A row of the newest posts with a sound player.

Deploy guides.

A free blog on Cloudflare

Build the blog as static pages and serve them on Cloudflare's free plan.

Running Khalid on a server

Run Khalid on your own server, beside your website or at its own address.

The full Margin guide

Sizes, spacing and every detail, in Khalid's docs.

Run your blog on Khalid.

Free and open source. One program, with SEO built in.