-
Browsing Past Published Articles on Ghost
Circumventing Ghost’s limited posts management capabilities.
I recently decided to spend some time editing past articles published on my Numeric Citizen Space website. I first thought that by going to my Ghost admin page, I could quickly browse past published articles by month. I couldn’t be more wrong. In fact, Ghost offers limited post management capabilities, thanks to its limited content browsing capabilities. I cannot go back, say, list articles published early in 2023. I can sort by ascending or descending order, but from there, I have to scroll through a long, dynamically created list of posts. It’s not very effective for a website with 600-plus posts. I had to find a different option to locate a post for an update. This is where Ghost’s content APIs come into play.
The following API request doesn’t do the job (API key voluntarily removed!):
curl -H "Accept-Version: v5.0" "https://numeric-citizen-introspection.ghost.io/ghost/api/content/posts/?key={APIkeygoeshere}&fields=title,url,published_at,updated_at&filter=published_at:>2024-01-01%2Bpublished_at:<2024-02-01" | json_pp
Let me explain what is this API request.
First, I’m going to the request using the macOS command line, hence the
curl
command. Next, the whole query follows in quotes. I query the content/posts API endpoint. Next, I pass my API key, followed by a field selection (&fields
), and next with the filter using the published date between two dates. Finally, I pipe the results in the pretty JSON print macro (is this a macro?) so the output looks like this:jfm@CraftingMAChine ~ % curl -H "Accept-Version: v5.0" "https://numeric-citizen-introspection.ghost.io/ghost/api/content/posts/?key={API-key-goes-here}&fields=title,id,url,published_at,updated_at&filter=published_at:>2024-01-01%2Bpublished_at:<2024-02-01" | json_pp { "meta" : { "pagination" : { "limit" : 15, "next" : null, "page" : 1, "pages" : 1, "prev" : null, "total" : 9 } }, "posts" : [ { "id" : "65b6a09840566000015b0d37", "published_at" : "2024-01-28T13:50:19.000-05:00", "title" : "My Weekly Creative Summary for the Week of 2024/03", "updated_at" : "2024-01-28T13:50:19.000-05:00", "url" : "https://numericcitizen.me/my-weekly-creative-summary-for-the-week-of-2024-03/" }, { "id" : "65b6540640566000015b0cf7", "published_at" : "2024-01-28T08:23:26.000-05:00", "title" : "Special Message to Paying Subscribers", "updated_at" : "2024-01-28T08:23:26.000-05:00", "url" : "https://numericcitizen.me/special-message-to-paying-subscribers/" }, { "id" : "65b16e25bc7fde0001314ccb", "published_at" : "2024-01-24T15:09:24.000-05:00", "title" : "The Mac Turns 40", "updated_at" : "2024-01-24T15:09:24.000-05:00", "url" : "https://numericcitizen.me/the-mac-turns-40/" }, { "id" : "65ad35418532ae000169ddd2", "published_at" : "2024-01-21T10:22:33.000-05:00", "title" : "My Weekly Creative Summary for the Week 2024/02", "updated_at" : "2024-01-21T10:22:33.000-05:00", "url" : "https://numericcitizen.me/my-weekly-creative-summary-for-the-week-2024-02/" }, ] }
Next, I copy the post ID of one article and paste it my browser for edition using this special URL:
https://numeric-citizen-introspection.ghost.io/ghost/#/editor/post/652e6eedb8a2650001ad9c5b
This URL brings me directly into the Ghost editor, provided that i was already authenticated with my account. That’s pretty much it. It could be much simpler. For this, I miss WordPress.
You can find the Ghost API document right here.
-
Documenting Blog Changes
Using Git instead of Dropbox for Blot content syncing provides an unexpected benefit.
As I recently wrote, Blot supports two mechanisms for synchronizing content from my Mac to the web: Dropbox or Git. I chose Git. As I write this, I’m still testing Nova as the Git front-end (I’m a GUI type of guy). One of the great benefits of using Git is the built-in history of commits that is at the core of any Git repo. As shown below, as I push updates to my Blot-based website, I make sure to write a short comment in the commit action to document the commit action. I think this is an important asset in managing a blog and owning its content.
A better view at the GIT panel in Nova: