My first ‘Git sourced’ blog post

  Edit this page

Today I wanted to apply ‘GitOps’ to my blogs. Would it be possible, easy and benificial to develop blogs and content with Markdown in a git repository while still using WordPress for publishing the content? That was the quest of the day 🙂

So here’s my first ‘git sourced’ blog!

Source file in a GitHub repo and published static page in WordPress on marcvanandel.nl.

And? Does that work? Yes! It does! :smiley:

Set up

The source of this page is a Markdown file in a public git repository. This could be a private repository as well. So first thing to do is preparing a git repository somewhere. I’m just using GitHub for this one: github.com/marcvanandel/marcvanandel.nl-bliki/.

Secondly you’ll need a WordPress site. As you can see I’m using my marcvanandel.nl website for that 😎

My first try was with the Documents from Git WordPress plugin. Source code and documentation is available in GitHub. This worked fine … for single blog posts, ’cause this plugin requires a 1-on-1 mapping between a WordPress page and a Markdown file. You had to create a WordPress page and apply shortcodes (DuckDuck is your friend 😉 ). This resulted into a published page, showing the Markdown content out of a GitHub file … but nothing more.

Some time later I discovered the Git it right plugin. This is what I wanted in the first place!! This plugin even has a GitHub webhook feature which triggers an update in WordPress to pull the changes of the configured set of Markdown pages and actually creates these pages inside WordPress. Searching through the content of the GitHub managed Markdown files is now supported! Awesome :sunglasses:

Top