Skip to content

Instantly share code, notes, and snippets.

@tobiaslidstrom
Last active May 15, 2026 09:49
Show Gist options
  • Select an option

  • Save tobiaslidstrom/8a75dbe9bc47f8e46d5dabc90cc11d61 to your computer and use it in GitHub Desktop.

Select an option

Save tobiaslidstrom/8a75dbe9bc47f8e46d5dabc90cc11d61 to your computer and use it in GitHub Desktop.
Tag based folder structure template for Calibre

Calibre Template

Generates the tag based folder structure

Tag/Author/Series (3) - Title/Author - Title.epub

Template Syntax

{:'sublist(raw_list('tags', ','), 0, 1, ',')'}/{:'re(sublist(field('authors'), 0, 2, ','), ',', ' &')'}/{series}{series_index:| (|) - }{title:re(:, -)}/{:'re(sublist(field('authors'), 0, 2, ','), ',', ' &')'} - {title:re(:, -)}

Tags

Retrieve first tag if exist.

{:'sublist(raw_list('tags', ','), 0, 1, ',')'}

Authors

Retrieve up to 2 authors. If more than one author use ampersand (&) as separator.

{:'re(sublist(field('authors'), 0, 2, ','), ',', ' &')'}

Series and Index

Retrieve the series and book number. If serie does not exist retrieve book title only.

{series}{series_index:| (|) - }{title:re(:, -)}

Filename

{:'re(sublist(field('authors'), 0, 2, ','), ',', ' &')'} - {title:re(:, -)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment