Managing Drupal Content in Git and Markdown - A Case Study

vasi
dergachev

It's become increasingly popular to build websites using a flat-file CMS, like Jekyll or Pico. They have many perceived advantages over a CMS like Drupal:

  • Tools: Edit your content in your favorite text-editor
  • Markup: Use simple languages like Markdown, instead of plain text or HTML
  • Version control: Store content in popular systems like git or mercurial, instead of a database
  • Concurrency: Have multiple people working on the same piece of content, and merge the results
  • Portability: Easily move content between dev, staging and prod

Working with the Linux Foundation, Evolving Web built a system to allow a Drupal site's content to be written in Markdown and stored in git. This brings all the above advantages to Drupal, with no need to abandon to many useful tools Drupal provides.

We wrote some useful migrate modules to do incremental import of the Markdown content into Drupal. This added functionality such as deleting old content, dry-run migrations, logging, multiple-level undo, and sanity-testing. We also built a navigation UI to quickly move through a deep hierarchical structure. Finally, we built a tool to compare the Drupal site against a site statically-generated from the same Markdown, to test the import functionality.

Session Track

Coding and Development

Experience Level

Intermediate

Drupal Version