How to write Ghost posts in Markdown and track via git?

Hi!

First off, I wanted to thank the team for creating Ghost - I love that it’s open source, user funded, and helping support the next generation of content creators. Awesome!

Currently I have a Jekyll blog hosted on GitHub pages, but I’m interested in switching to Ghost for the Members features.

I would prefer to write my posts locally in Markdown, track their history using git (via a repo on GitHub, and then publish them to hosted Ghost when ready.

Is this workflow possible? I’ve done a bit of searching and it does not appear to be trivial currently.

  • As announced in the The New Ghost Admin API: Build advanced publishing workflows and Ghost on the JAMstack – Future-proof Professional Publishing blog posts, it appears like there is support for using Ghost’s backend and Gatsby as the frontend to generate a site (via gatsby-source-ghost plugin and `gatsby-starter-ghost for example. Some additional details here: Using Gatsby + Ghost).
    • However, I want to write posts in Markdown offline like one would do with a static site generator such as Gatsby/Jekyll/Hugo, etc., and then publish to Ghost.
  • Some blog posts (http://www.how-hard-can-it.be/post2ghost/) provide one-off scripts to upload Markdown content to the Ghost API.
  • Others have written their own hacks (https://github.com/mariusepi/Ghost2Git) to allow collaborative editing/version control.

If I was able to simply write posts in Markdown, offline, in my IDE, and store those posts in git, I would get the following for free with no work on Ghost’s part:

  • Multi-author writing
  • Infinite, fine-grained history
  • Use an existing writing flow I’m comfortable with
  • Write offline

In short: being able to use a static site generator writing flow in Ghost would be great for me, and I imagine many others coming from that background. If there’s an easy way to do it, please let me know! :pray:

You can publish to ghost from iA Writer or Ulysses on Mac. Post2Ghost or another API/command line client will let you use your existing IDE.

GitHub offers web hooks that you can use to trigger Post2Ghost to run on a push, commit, or tag. If you’re using GitLab, you can modify the GitLab CI YAML to use a command to run something like Spooky to publish your post.

If you push regularly to your git repo, it’ll probably be worth updating the script to enumerate the posts and match the title (or slug), and then do an update instead of create/publish.

It’s possible to do, but how easy you can do it varies depending on the IDE/Markdown Editor, or if you want a pure Git workflow.

The forum won’t let me share links to everything, so if you need more clarification, feel free to ask.

Hey @kmwallio! Thanks so much for the detailed info and quick response, I really appreciate it!

Hm good point, GitHub Action + Post2Ghost could work. I’ll give it a try and when I get the chance.

Friendly ask to the Ghost team Powers That Be, if they’re reading this, that supporting static site generator-esque writing flows would be :100:

So that they’re all tracked in the same place, see also @andrewklajman’s post here: Bulk import markdown text as posts in Ghost.