In my previous blogpost I mentioned that I hacked together a small
script stitching my blog and the fediverse together. Now I’ll go a
little more into details.
You can find a copy of my script here.
Hakyll, in the default configuration, has a
blogposts as markdown, having the publishing-date set in their filename.
I usually keep unfinished blogposts as
.md-files in my
folder, without having the timestamp in the filename yet. It’s still
quite hacky, but it works for now and I don’t have the freetime right
now to build a better fediverse-integration.
There are only two external programs used:
Configuring the script
In the beginning, I have to setup some parameters. I use
pass as my
passwordmanager to store the password to my blog’s fediverse-account.
Since my domains and stuff are no secret I’ll just use them as an
POSTS_DIR="$HOME/blog/posts" USER="blog" PASSWD="$(pass internet/social.fyber.space/blog)" INSTANCE="social.fyber.space" BLOG_DOMAIN="blog.fyber.space"
The script takes one commandline-parameter, the path to the draft to stitch and publish. When executed it basically does the following things:
Copy the draft to the
posts-folder, setting the date in the filename.
POST-request posting a new Status on your fediverse-account.
Parse the response and extract the url of the new status.
Append a Discuss-link at the end of the post pointing to the status in the fediverse.
Afterwards, you just havt to run the usual
stack exec site build stack exec site deploy
It would be cool to integrate this functionality directly into Hakyll. Eventually this comes on my list with things to code on the next CCC-Event which would be the GPN19 in Karlsruhe for me this year.