Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Customizing the Template

This is a quick introduction to customizing the Typst template for advanced users. You can skip this section if you are happy with the default layout.

Every project has a {name}.typ file — a Typst template that controls how the PDF looks. fotobuch generates this file for you when you create a new project (via the GUI New project dialog or the CLI fotobuch project new command), but you are free to edit it. fotobuch will not overwrite your template once created, so your changes stay safe and can be reused across projects.

Make sure that during your edits you do not change the lines

#let is_final = false
#let project_name = "{project_name}"
#let data = yaml(project_name + ".yaml")
#set text(font: "Libertinus Serif")

otherwise it won’t compile.

Important: Always edit {name}.typ, never final.typ. The final template is auto-generated from yours during a release build (with is_final = true). Your changes in final.typ would be overwritten.


Preview overlays

These settings only affect the preview PDF. They are automatically disabled in the release build. Configure them in {name}.yaml:

config:
  preview:
    show_filenames: false    # show filename caption on each photo
    show_borders: true       # red bleed border + blue margin border
    show_slot_info: true     # slot address and weight on each photo

Turn on show_filenames when you’re trying to identify which photo is where. Turn off show_slot_info once you’re happy with the layout and just want a clean preview.


Photo index (appendix)

The template can append a photo index at the end of the book — a compact reference listing every photo with its group, timestamp, and a reference back to its page position. Configure it under config.book.appendix in {name}.yaml:

config:
  book:
    appendix:
      active: true
      columns: 7
      ref_mode: "positions"   # or "counter"
      label_title: "Photo Index"
      label_page: "Page"
SettingDefaultEffect
activefalseEnable the appendix
columns7Number of columns in the listing
ref_mode"positions"How photos are referenced (see below)
page_separatorfalseShow a page-number header between pages
strip_timestampstrueTry to strip leading timestamps from filenames
label_title"Photo Index"Localization: Title text
label_page"Page"Localization: “Page” label
date_format"{day}. {month} {year} {hour}:{min}"Timestamp format
date_months["Jan", …, "Dec"]Month abbreviations

Reference modes

"positions" (default) — Each photo is referenced as page.slot, e.g. 2.3 means page 2, slot 3. No visual badge is added to the photos.

"counter" — Photos are numbered sequentially (1, 2, 3, …) and a small badge with the number appears in the bottom-right corner of each photo in the PDF.

Localization example

To produce an appendix in a different language, override the label fields and month abbreviations:

config:
  book:
    appendix:
      active: true
      columns: 6
      ref_mode: "counter"
      label_title: "Photo Index"
      label_page: "Page"
      date_format: "{day} {month} {year}"
      date_months: ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
                    "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]

Going further

The template reads layout data from {name}.yaml via #let data = yaml(…).

A few things to keep in mind:

  • is_final controls preview vs. release mode. Use it to conditionally show or hide elements: #if not is_final [Draft watermark].
  • Image paths are resolved relative to the project root via cache_prefix. Preview images live in .fotobuch/cache/{name}/preview/, final images in .fotobuch/cache/{name}/final/.

If you want to start over with the default template, create a fresh project and copy the generated {name}.typ back.