expl0it3r / kirby-timeline
A vertical timeline with category filters and a search for Kirby
Package info
github.com/eXpl0it3r/kirby-timeline
Type:kirby-plugin
pkg:composer/expl0it3r/kirby-timeline
Requires
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-04 10:45:34 UTC
README
A vertical timeline for Kirby: events on both sides of a line, grouped by year, with category filters and a search.
The events are rendered by PHP, so the timeline is complete without JavaScript. The script adds the filters, the search and folds the details away until an event is clicked.
Installation
Both Composer and git submodules are supported. Built and tested with Kirby 5.
Composer
composer require expl0it3r/kirby-timeline
Git Submodule
git submodule add https://github.com/eXpl0it3r/kirby-timeline.git site/plugins/kirby-timeline
Download
Download the repository and copy its files to site/plugins/kirby-timeline.
Usage
Add the field to the blueprint of a page and set your categories, e.g. in site/blueprints/pages/history.yml:
title: History fields: timeline: extends: fields/timeline fields: category: options: release: Releases patch: Patches
Enter the events in the Panel, or write them directly to the content file:
Title: History ---- Timeline: - date: 2014-07-29 category: release major: true title: Version 1.0 released detail: After two years of beta the first stable version is out. - date: 2014-09 category: patch title: Version 1.0.1 fixes the installer
Then call the snippet in the template, here site/templates/history.php:
<?php snippet('timeline', [ 'events' => $page->timeline(), 'categories' => ['release' => 'Releases', 'patch' => 'Patches'], ]) ?>
That's all you need, the stylesheet and the script are loaded by the snippet. The sections below cover the options in more detail.
Blueprint
The plugin comes with a structure field for the events. Extend it and set the categories of your site:
fields: timeline: extends: fields/timeline fields: category: options: release: Releases patch: Patches
An event has the following fields:
dateasYYYY,YYYY-MMorYYYY-MM-DD, an event with only a year or a month comes before the dated ones of that year or monthcategoryis one of your optionsmajormarks the event with an accenttitledetailis shown once the event is clickedlabelreplaces the formatted date, e.g. "Second half of 2015"
Snippet
<?php snippet('timeline', [ 'events' => $page->timeline(), 'categories' => [ 'release' => ['label' => 'Releases', 'shape' => 'diamond', 'color' => '#f78f0b'], 'patch' => ['label' => 'Patches', 'shape' => 'square'], ], ]) ?>
-
eventsis the structure field, its structure or an array of arrays -
categoriesare the filters. A category is either just its label or an array withlabel,shape(diamond,square,circleortriangle) andcolor(any CSS color, alsovar(--something)). Events of a category that isn't listed are left out. Without categories there are no filters and every event is shown. -
groupsare the headings:'year'(default),'none'or your own, as start dates with their headings:'groups' => ['0000' => 'Early Days', '2012' => 'Beta', '2014' => 'After the Release'],
-
placeholderis the placeholder of the search -
searchset tofalseleaves the search out -
assetsset tofalseskips the tags for the stylesheet and the script, if you'd rather bundle them yourself. Otherwise the first timeline of a page brings them along.
Styling
Everything that depends on the site is a custom property. Set them on .timeline or anywhere above it:
.timeline { --timeline-bg: #fff; --timeline-surface: #f4f4f4; --timeline-surface-active: #e6e6e6; --timeline-text: #333; --timeline-heading: #111; --timeline-muted: #777; --timeline-border: #ddd; --timeline-accent: #f78f0b; --timeline-line: linear-gradient(#5cb8ff, #f78f0b); --timeline-radius: 5px; --timeline-font-mono: monospace; /* Height of a fixed navigation, so the filters stick below it */ --timeline-sticky-top: 60px; }
The defaults are made for a dark page.
Languages
The texts of the plugin are translated to English and German. Add or overwrite them in your language files:
'timeline.search' => 'Search the timeline', 'timeline.count' => '{count} of {total} events', 'timeline.empty' => 'Nothing matches. Try a different filter or search term.', 'timeline.months' => 'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec',
License
This software is available under the MIT license, see the license file.
