So @dwwoelfel and I have been working on a powerful blogging system that keeps all of your data inside of GitHub issues - you can see the result (and post yourself) live on essay.dev - or you can fork the open-source repo and deploy your instance, and all the instructions below will work just fine on your own repo.
The entire site is powered by GitHub issues and next.js (and hosted on Vercel). Any issue with a Publish
tag will be made publicly available immediately (and can be similarly unpublished by removing the Publish
label).
That's pretty fantastic for lots of reasons - your posts are now in an API that's easy to slice and dice so there's no lock-in to your content or comments, it's a familiar place for devs to work, etc.
There are hundreds of features and polish in essay.dev, but importantly for me, it's compatible with emacs' magit-forge
!
magit-forge
, I choose you!magit
is the famous git control system for emacs, and it has an equally powerful integration to manage GitHub issues called magit-forge
.
You can do all the normal CRUD operations on GitHub issues inside a familiar emacs workflow - which means we can do the same for our posts1!
First make sure you've installed magit
and magit-forge
(or for spacemacs users, just add the GitHub layer
).
Now, let's clone the essay.dev
repo:
git clone https://github.com/OneGraph/essay.dev.git
cd essay.dev
emacs README.md
Next we'll connect forge
with our GitHub repository via M-x forge-add-repository
- and now we're ready to see a list of all of the posts, so run M-x forge-list-issues
:
If we hit Enter on any of the issues, we'll see the content and the comments:
Running M-x forge-create-issue
will create a new buffer pre-filled via the default new-post
template:
Simply fill out the title and the body, and when you're ready, "commit" the new post via C-c C-c
. Forge will commit it to a local database first for safe-keeping, and then create an issue on GitHub! Back in the *forge-issue-list...*
buffer, hit g to refresh the lists of posts, with your newest one at the top. Hit Enter on it to view the contents.
A few seconds later, run M-x forge-pull
to update your local copy - you should find there's a new comment waiting for you from onegraph-bot
:
View your post at https://
.essay.dev/post/ /
That's it, your post is available to the world.
You can also leave comments on your posts (and others) with M-x forge-create-post
:
It'll show up instantly on your post (both in forge and on the site):
Your content belongs to you, and is easily accessible through the GitHub API - here's an example query that'll pull out the posts for you:
query MyPostsOnGitHub(
$owner: String = "onegraph"
$name: String = "essay.dev"
$createdBy: String = "sgrove"
) {
gitHub {
repository(name: $name, owner: $owner) {
issues(
first: 10
orderBy: { field: CREATED_AT, direction: DESC }
filterBy: { createdBy: $createdBy }
) {
edges {
node {
body
number
title
}
}
}
}
}
}
Try it out here
And again, note that this setup will work with any repo, so if you want to self-host your content it's as easy as using the deploy on vercel link.