Publishing writing quickly on the web
Efficient methods for publishing content on the web
Establishing flow
In my opinion, one of the most important parts of the production process is establishing a proper flow. To do this, you need to create a space that is as seamless as possible and take steps to refine that space over time. I realize that sounds a bit abstract.
My goal with this website was to smooth out the process by minimizing effort and allowing for quick content entry. To achieve this, I felt I needed to simplify the entire publishing workflow as much as possible. I decided the best way would be to connect my website to a source fed from existing Markdown (.md) files. Maybe using a cloud service—this way, I'd also have a backup of every post.
WordPress – Git it Write
I use WordPress [1] to publish posts on my website. Initially, I looked for ways to do this within WordPress and found a plugin called Git it Write in the directory. It seemed like exactly what I needed.
[1] Note: I have since transitioned my website from WordPress to a "digital garden." However, the data is still synced via GitHub...
Hello GitHub
This plugin requires GitHub on the cloud side. I created a new project on GitHub and renamed the initial branch to master. By default, this branch is created as main, and it took me a while to resolve a few issues because of that discrepancy 🤨. After that, I went to the Webhooks page in the project settings and added a new webhook.
GitHub settings
Webhooks settings
URL: https://github.com/mrsarac/mustafasarac-blog/settings/hooks/
Payload: https://mustafasarac.com/wp-json/giw/v1/publish
Content type: JSON
Secret: **** <- I entered a random password here
Just the `push` event.
WordPress plugin settings
WordPress Settings
Webhook secret: **** <- the random password I entered on GitHub
Github username/owner: mrsarac <- my GitHub profile
Repository name: mustafasarac-blog <- the project name
Folder to publish from: published <- the folder containing the files to be published
I also saved the KEY I generated here in the "Git it Write" plugin settings. This established the link between my local repository and my website.
It might sound complicated at first, but once set up, it's actually quite simple.
A bit of terminal
I cloned the project via terminal:
git clone git@github.com:mrsarac/mustafasarac-blog.git <- project's git URL
Then I saved my files into the 'published' folder and pushed them to Git.
One important detail: you can add YAML frontmatter at the beginning of each file to define the title and category.
---
title: Publishing writing quickly on the web
menu_order: 1
post_status: publish
post_excerpt: This is a post excerpt
taxonomy:
category:
- category-slug-1
- category-slug-2
post_tag:
- tag-1
- tag-2
custom_fields:
field1: value 1
field2: value 2
---
After...
Now, let's push the file to Git:
git commit -m "My first post on GitHub"
The file I pushed was published instantly.
A small addition
Even if sync issues occasionally arise, it generally works well. I noticed an issue where 'changing' a file didn't always trigger an update. While creating new files was seamless, it wasn't always updating existing posts. I fixed this by manually triggering an update command through the link on the plugin's management page.
That's all
I'm leaving this post in this sync folder as my first entry and performing the git commit.
Efficient methods for publishing content on the web