Manage ghost blog out of the site

Hi everyone

Is there any possible way to post and update ghost blog outside?
Currently what I can do to post and update is:

  • navigate the ghost blog site
  • click post/update button for specific blog

What I wanna do is:

  • To update the blog

    • open markdown file on github or somewhere else
    • update the content
    • once I save it, then the blog content on ghost site updated automatically
  • Similar to the post

Instead of using ghost blog site’s feature, I’d like to view and update it out of the site

Best
Khanh

Hey @duy_khanh_nguyen :wave:

You could probably use Github Actions combined with the Ghost API to do update the post(s) that changed. Something like:

when a commit is pushed to the main branch:
  see what markdown files changed / were created
  for every changed file:
    fetch the post from the Ghost API using the slug
    update the post using the Ghost API

  for every new file:
    create a new post in ghost    

Is this what you were looking to do?

1 Like

Thanks for your reply @vikaspotluri123
Would you explain me more about the Github Action + Ghost API?
Is there any example?

Sure - Github actions is a CI/CD tool from Github that lets you do certain things based on different events. The Ghost API allows you to interface with your Ghost blog in a reproducible and stable manner.

The best example of a Github Action w/ Ghost is action-deploy-theme:

Source:

Here’s some related documentation:

Ghost Admin API:
https://ghost.org/docs/api/v3/admin/#posts

Github Actions:

Just curious @vikaspotluri123, how could I use action-deploy-theme for blog post/update?
Originally, I was thinking to build the backend watches github files and reflects it with Ghost blog API.
If I can do this by using Github Actions without using any backend, that would be perfect.

You wouldn’t be using action-deploy-theme specifically; that’s just a starting point to writing the automation - you can see how it works, and what it does so you can write your own “on change” handler to update the posts

Here’s another related action:

1 Like

Thanks a million!