In my search for a lightweight WordPress alternative which uses real CSS I stumbled across Grav. Out of the box I was quickly impressed with the ease of installation and the quality of the documentation. For some the use of markdown rather than a full WYSIWYG editor might be an issue, but I actually like it, and the implementation in Grav is smooth enough that you don’t really need to remember markdown in order to use it.
So far so good. I followed some of the tutorial to build my own theme. Initially I was pleased with how smoothly this went. It was joy to use raw CSS and style the theme easily without trying to second guess the quirks of the WordPress themes UI. Everything was very smooth until I tried to add in a blog component to the theme. This is not covered in the tutorial. It is even helpfully disclaimed:
“You might need to tweak the markup to suit your theme. The best option if you’re just starting out is to use a theme that already comes with them.”
Such warnings are there to be ignored so I rushed on in, copying in the blog, item and sidebar templates from another theme as suggested. I also added the archive plugin to give me post archives in the sidebar.
It was here it came to a crashing halt. The sidebar was either beautifully devoid of my test archive posts, or the whole page crashed in a well-documented but still pretty scary debug screen.
Poking around I was convinced that the issue lay in the route and filter options of the Archive plugin. These are used to tell the archive where to look for the old blog posts. This combined with my choice to make the blog appear at the root directory rather than under an unsightly /blog url was definitely the issue. Unfortunately no matter how I tweaked it, nothing worked. It was only after I changed the home page folder name /squiggy that I realised the issue.
Grav, very helpfully caches stuff. Great for performance. A nightmare when developing, as you can never tell whether you are testing against the change you have just made or a previous cached version. Fortunately, once realised it is easily fixed.
For future reference to clear the cache in grav
bin/grav clearcache --allBashYou can also turn the cache off under the configuration panel in the Admin screen.
Once this was done, changing both the route and filter to a vanilla “/” fixed my issue and I was back on track.


Leave a Reply