Install Grav CMS and create a timeline
There are various options including whether or not to have a UI for the admin. I installed the version with admin, since having an admin UI can be handy and security is not a particular concern for this site.
Install base site
- Add DNS A record for the new site name e.g.
grav.example.com
- Download latest release of grav + admin
- Upload to server:
scp grav-admin-v1.7.38.zip user@server.com:grav-admin-v1.7.38.zip
- Unzip to web root:
sudo unzip grav-admin-v1.7.38.zip -d /var/www
- new directory created will be/var/www/grav-admin
- Update permissions:
sudo chown -R www-data:www-data grav-admin
- Copy example nginx config into sites-available e.g.
cp /var/www/grav-admin/webserver-configs/nginx.conf /etc/nginx/sites-available/grav
- Edit nginx config for web root, server name and correct version of the PHP-FPM module available
- Symlink into sites-enabled:
sudo ln -s /etc/nginx/sites-available/grav /etc/nginx/sites-enabled
- Restart nginx:
sudo service nginx restart
- Browse to site on http - should work
- Generate SSL cert:
sudo certbot --nginx -d grav.example.com
- Browse to site on https - should work and should be presented with the admin user creation
- Create an admin user - password needs to have a capital letter, lowercase letter and a number (not obvious if trying to use an xkcd style password)
Install the timeline plugin
An example of the Grav timeline plugin in action can be seen here. It requires php curl and zip modules to be installed.
- Check version of php:
php -v
- Check php curl modules available:
sudo apt-cache search php | grep curl
- Install correct version: e.g.
sudo apt-get install php8.2-curl
- Ditto with zip
- From the root grav directory e.g.
/var/www/grav-admin
, install the timeline plugin as the nginx web server user:sudo -u www-data bin/gpm install timeline
Create a timeline
- Create a new folder for the timeline area e.g.
03.composers
- Create a base page for the timeline with the name
timeline.md
- add any regular contents to this page which will show as the header, intro etc - Create folders for events in the timeline. These can be nested:
sudo mkdir -p baroque/handel
sudo mkdir -p baroque/bach
sudo mkdir -p classical/mozart
4. Within each group folder e.g. baroque
create a timeline.md
file. This will provide the text to introduce events in this period. The date
front matter seems to be required to order this section correctly with other sections. The locale
front matter seems to be required to parse the date correctly (everything ends up in a heap of debug splurge on the screen without it). Sample contents:
---
title: Baroque
date: '1600-01-01'
locale: 'en'
---
5. Within each sub folder e.g. baroque/handel
create a timeline_event.md
file. This will provide details of the actual event.
---
title: Handel
date: '1685'
date_format: 'Y'
locale: 'en'
---
Some text