Skip to content

OleVik/grav-skeleton-timeline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Timeline Plugin

Table of Contents

Timeline

The Timeline-plugin is for Grav CMS, and lets you create and manage timelines in an ordered, hierarchical fashion. Timelines can be nested within each other, minutely customized on a page-level, and further customized with your own templates and styles. A demo is available, and demo content can be found in /pages.

Before configuring this plugin, you should copy the user/plugins/timeline/timeline.yaml to user/config/plugins/timeline.yaml and only edit that copy.

Here is the default configuration and an explanation of available options:

enabled: true
language: en
order:
  by: date
  dir: asc
cache: native
truncate: 100
Variable Default Options Note
enabled true true or false Enables or disables the plugin.
language en string (2) Any two-letter (ISO-639-1) language code.
order:
by date date, title, or folder Orders pages according to date, title, or folder-name.
dir asc asc or desc Order pages ascending or descending.
cache native native, persist, transient, or disabled Where to store plugin's internal data.
truncate 100 int or boolean Limits the amount of words in each note, to an integer or boolean state for default (100).

Each timeline is structured with a Header (timeline.md, Timeline-template) and Events (timeline_event.md, Timeline Event-template). Headers are used as separators and can order their descendant Events, as well as contain normal fields such as title, subtitle, and content. Events also render a formatted, localized date (using date_format and locale), as well as an image. In addition, Events are cast as Linked Data with JSON-LD, wherein type, place, locality, and region are used.

Sound confusing? It's much easier to do all this from the Admin-plugin:

Any Page that you create in Grav with the filename timeline.md is the wrapper for the Timeline, and will take any Pages created with the filename timeline_event.md as its Events. Consider the Constantinian Dynasty, in this folder. The initial timeline.md creates the Page at https://olevik.me/staging/grav-skeleton-timeline/timeline/dominate, and all the Pages below it are Events - each with their own timeline_event.md, like Julian at https://olevik.me/staging/grav-skeleton-timeline/timeline/dominate/constantinian/julian.

The plugin assumes some knowledge of basics with Grav, largely Pages and FrontMatter. If you are using the Admin-plugin, you will need to create a Page using the Timeline or Timeline Event template:

  1. Go to the Pages-administration:

Pages-list in Admin

Clicking the Add Page button yields:

Add Page Dialog

Header Page

Project Space

Event Page

Project Space

Event Options

Project Space

Installing the Timeline-plugin can be done in one of two ways. The GPM (Grav Package Manager) installation method enables you to quickly and easily install the plugin with a simple terminal command, while the manual method enables you to do so via a zip file.

This plugin will only work with Grav v1.6 or higher, as it requires PHP v7.1 or higher. Dropping this requirement would mean devolving features, which the developer is not inclined to do.

The intl-extension for PHP must be installed and enabled to use this plugin.

The simplest way to install this plugin is via the Grav Package Manager (GPM) through your system's terminal (also called the command line). From the root of your Grav install type:

bin/gpm install timeline

This will install the Timeline-plugin into your /user/plugins directory within Grav. Its files can be found under /your/site/grav/user/plugins/timeline.

To install this plugin, just download the zip version of this repository and unzip it under /your/site/grav/user/plugins. Then, rename the folder to timeline. You can find these files on GitHub or via GetGrav.org.

You should now have all the plugin files under

/your/site/grav/user/plugins/timeline

NOTE: This plugin is a modular component for Grav which requires Grav and the Error and Problems to operate.