I can now use Micropub to publish to my blog
I can now make use of Micropub to post on my blog!
I am in search for an easier way to blog from the go for quite some time now. Recently, I implemented a web-based form to submit new posts using the API of my self-hosted Gitea. While that worked, it was still not optimal.
I already heard of Micropub before, since I joined the IndieWeb, but I was always a bit scared of complexity to develop my own solution. So I searched instead for already existing solutions, which I could modify to better fit my custom requirements.
It is definitely not made as a generic solution, but it may be helpful for everyone needing a starting point or some inspiration themselves.
Compared to the original gozette I made the following significant changes:
- Removed all dependencies and rewrote the HTTP handling with the Go standard library
- Added support for Gitea and removed everything related to Github (seems like the Gitea API, or the one used endpoint, is actually much simpler than Github’s API)
- Added support for multipart-data (some clients require this)
- Added a custom hack to add a post to a content section using a prefixed category
- Added another custom hack to also set a custom slug with clients that support categories, but not slugs (also done via adding a category with a specific prefix)
- Adapted the post generation to my setup (YAML front matter instead of TOML etc.)
- A lot more code restructuring etc.
My next planned steps include:
- Adding support for posts without titles to my Hugo theme
- Adding support for more post types including likes, replies, etc.
- Adding a section for microblog interactions on my blog that isn’t shown on the homepage or in feeds
- Automatic webmention sending after posting
In the end, after rewriting much of the code and actually reading parts of the Micropub specification, I found out, that Micropub isn’t as complicated as I feared earlier. Micropub is awesome!
Doing things like this is so interesting! Although it doesn’t have much practical value (I could just use a WordPress site and wouldn’t have all those problems), I’m learning a ton of new stuff and it’s just fun!
Tags: Blog Hugo IndieWeb Micropub