Grav Is A New Flat-File Content Management System

Content ManagementWordPress and most other popular content management systems store content in a relational database like MySQL. While there are advantages to using a database, it adds a layer of complexity that isn’t necessary for many sites. An alternative is to simply store content, template, and configuration files on the server’s filesystem. Content management systems that take this approach are known as flat-file CMS’s. Over the last couple of years, a number of flat-file CMS’s have entered the market, most notably Statamic, which now has competition from Grav, a new flat file CMS from RocketTheme.

Before we discuss Grav, I’d like to clear up a source of confusion about flat-file content management systems — they aren’t the same as static site generators like Jekyll or Wintersmith. Static site generators take HTML, CSS, content like Markdown and images, and other files, combine them with template files, and build a static site. That site is uploaded to a server and doesn’t change until the next time the static site generator is run. Flat-file content management systems don’t work this way. They create web pages dynamically when they receive a request from a browser (leaving caching aside for the moment). Grav generates its pages dynamically using PHP, just like WordPress does. The difference lies in how the content files that are processed into web pages are stored.

The major advantage of using the filesystem to store content is that those files can be treated like any other files. Grav users can write in Markdown, upload to a folder on their server, and the CMS will take care of the rest. A second major advantage is that content files can be version controlled with a system like Git or even Dropbox, with all the associated collaboration and workflow benefits that entails.

Grav

Flat file storage is useful, but a content management systems need more than that to be taken seriously. In terms of features, Grav does not disappoint. It nicely straddles the line between user-friendliness and developer-friendliness. Although flat-file CMS’s don’t need an admin panel because they can be configured by editing files, Grav includes an optional admin interface that makes it a good option for non-technical users, in addition to Markdown conversion, an extensive lineup of free plugins and themes, one-click install, and dynamic image manipulation.

I’ve made an effort to stress the difference between Grav and a static site generator, but there are some features that will be familiar to anyone who has used Jekyll and the like — the templating system and YAML front matter.

Grav’s template system is simpler to use than WordPress’. It’s based on the popular Twig template language, which isn’t too difficult to grasp for anyone with a bit of development experience. If you can design and build a webpage, and have time to spare to learn Twig’s relatively simple syntax, you can build a Grav template — PHP dark arts aren’t essential, although if you want, you can leverage your PHP knowledge within Twig. The Grav team have provided a great set of documentation to get you started on theme building.

YAML front matter works the same way it does in most static site generators. Grav users are free to create custom variables in the front matter, which can be referenced in templates to create flexible custom dynamic fields within pages.

Grav’s most prominent competitor in the flat file CMS field is Statamic, but Grav has a different business model — it’s free and open source. Presumably, ThemeRocket intends to monetize Grav by selling premium services, themes and plugins.

So, is Grav worth trying? If you’re an experienced WordPress user or a non-technical user who wants to start a business site or blog, I recommend you go with WordPress. If you’re a developer, Grav is well worth taking a look at — its templating system is more flexible and easier to learn, its flat files are easier to manage and more user-friendly than a superfluous MySQL database, the simple admin interface is likely to cause developers and professionals less headaches, and it has a more modern architecture.

If you want to give Grav a spin, take a look at this guide to getting Grav up and running in Vagrant.

Matthew Davis is a technical writer and Linux geek for Future Hosting.

Dedicated Server Special

Take advantage of our Double RAM offer on the E3-1230v2 4 x 3.30GHz+HT server! Only $134.95 per month. Managed and Unmanaged options available at checkout.

GET STARTED