kirby-grimoire/
├── assets/
│ ├── css/
│ │ ├── processing.css # Tailwind source
│ │ └── tailwind.css # Compiled output
│ ├── js/
│ │ └── main.js # Custom JavaScript
│ └── img/
│ └── fallback.jpg # Default cover image
├── content/ # Content storage
│ ├── site.txt # Site metadata
│ └── [numbered-books]/ # Book directories
├── kirby/ # Kirby CMS core (vendor)
├── media/ # Auto-generated thumbnails
├── site/
│ ├── blueprints/ # Panel field definitions
│ │ ├── site.yml # Site settings blueprint
│ │ ├── pages/
│ │ │ ├── book.yml # Book field definitions
│ │ │ └── chapter.yml # Chapter field definitions
│ │ └── files/ # File field definitions
│ ├── config/
│ │ └── config.php # System configuration
│ ├── models/ # Custom page models
│ ├── snippets/ # Reusable code fragments
│ │ ├── head.php # HTML head section
│ │ └── scripts.php # JavaScript and styles
│ └── templates/ # Page rendering
│ ├── home.php # Landing page
│ ├── book.php # Book detail page
│ ├── book.xml.php # RSS feed template
│ └── chapter.php # Chapter reading page
├── .htaccess # Apache configuration
├── composer.json # PHP dependencies
├── package.json # Node dependencies
└── tailwind.config.js # Tailwind configuration
Grimoire stores user preferences and progress in browser LocalStorage using the following keys:
| Key | Data Type | Purpose |
|---|---|---|
grimoire_theme |
String | "light" or "dark" |
grimoire_font_size |
String | "small", "default", or "large" |
grimoire_chapter_progress_{bookId} |
Array | List of completed chapter IDs |
grimoire_reading_position_{bookId}_{chapterId} |
Object | {scroll: Number, timestamp: Number} |
Example Reading Position:
{
"scroll": 2840,
"timestamp": 1698765432000
}
All content stored in plain text format with YAML frontmatter.
EXAMPLE 7.3.1: Book Metadata (book.txt)
Title: The Manual
----
Subtitle: A Comprehensive Guide
----
Author: Technical Publications
----
Blurb: Complete system documentation
----
Cover:
- cover.jpg
----
Rating: sfw
----
Seriesname: Documentation Series
----
Seriesnumber: 1
EXAMPLE 7.3.2: Chapter Content (chapter.txt)
Title: Chapter One
----
Subtitle: Getting Started
----
Wcontent:
This is the chapter content written in Markdown.
## Headings Work
- Bullet lists
- Also work
**Bold** and *italic* supported.
----
An: This is an author's note.
----
Anmode: after
Kirby automatically selects templates based on page type:
Page Type → Blueprint → Template → Output
──────────────────────────────────────────
site → site.yml → home.php → HTML
book → book.yml → book.php → HTML
book.xml → (same) → book.xml.php → XML/RSS
chapter → chapter.yml → chapter.php → HTML
Tailwind Configuration (tailwind.config.js):
darkMode: 'class')site/**/*.php, site/**/*.js, content/**/*.txtCustom Styles (site/snippets/scripts.php):
Inline <style> block provides:
All reading features encapsulated in Grimoire namespace.
Core Modules:
Storage Utility (Grimoire.storage)
get(key, defaultValue): Retrieve from LocalStorageset(key, value): Store in LocalStorageReading Progress Bar
requestAnimationFrameScroll Position Tracking
Chapter Completion Tracking
Font Size Controls
Theme Toggle
dark class on <html> elementDistraction-Free Mode
requestAnimationFrame for performanceKeyboard Shortcuts
Grimoire does not provide a REST API. All content access occurs through rendered HTML pages and RSS feeds.
Public URLs:
| Pattern | Description |
|---|---|
/ |
Home page (all books) |
/{book-slug} |
Book detail page |
/{book-slug}.xml |
Book RSS feed |
/{book-slug}/{chapter-slug} |
Chapter reading page |
/panel |
Administrative interface |
Kirby's Markdown Extra features enabled by default.
Supported Syntax:
image: and file: