Writing blog posts and getting them out takes far too much effort. With a
streamlined publishing system the author still has to manage to write something
down.
I do not have a streamlined publishing system. Instead the tools I use sit in a
balance between the ideal thing I want and the hacked together scripts I have.
It has been 4 months since my last post, so you can join me on a refresher.
The web side of the software is written in nodejs using express (and python
with flask, but that isn't finished). The node program starts up and parses in
a configured directory containing the blogposts.
$ cd blogposts
$ git pull
Already up-to-date.
The blog posts live in git and are written in markdown. Images for the posts
are kept in the images subdir. The blog posts themselves live in year folders
(2014,2014, etc). The year folders are provided as configuration to the node
web process as well, which implies there is work to do when the calendar flips
around.
$ ls
2013 2014 2015 2016 drafts images newid.sh old
$ ls 2016
32c3.md glitchcards.md unreasonable0x02.md
acuratefbsdaudio.md lighttheme.md unreasonable0x03.md
dso138kit.md more-unreasonable.md update.md
fbsdpixorg.md notifications.md vimcrypt.md
ffmpeggif.md pan.md xxx.md
freebsdbuildflags.md ubuntu-touch.md
freebsdrecaudio.md unreasonable.md
blogposts have an id, which is used to sort and sequence them and is used for
the post url. It was needed in earlier pieces of software I wrote and I would
like it to go away. Until I move to something else I have a helper script to
tell me what the next id is.
$ sh ./newid
last post id: 0089
next post id: 0090
blogposts use an email style header, each line is a key value pair separated by
the first colon on the line. The header block is terminated with two newlines
'\n\n'. I can type out the header, but normally I copy it from a blogpost.
That's the sort of lazy person I am.
$ copy 2016/somepost.md to 2016/newpost.md
$ vim 2016/newpost.md
Title: Some post
Tags: meta
Date: 2016-01-01
Preview: Some post
Permalink: 0001
Hurr durr I am a blogpost
I am totally inciteful and full of useful information, like how nat punch
through works and the secret to everlasting life.
Now we have to edit all of the fields in the header, and content for the body
of the blogpost. This is a great time to add the correct post id value we got
way up top.
Title: Writing this takes a little too much effort
Tags: blog
Date: 2016-09-26
Preview: Writing this takes a little too much effort
Permalink: 0090
Writing blogposts takes far too much effort...
Okay, we have now written the blogpost, maybe even spell checked, we can upload
it to the web server.
$ git add 2016/newpost.md
$ git commit -m "blogpost"
$ git push
On the remote web server we need to pull from the master blogposts branch to get
the new article we wrote.
$ ssh webserver
$ cd sites/blogposts
$ git pull
Now we have the updates we have to restart the node process. There is code to
reload dynamically, but I could never get nodejs to behave here. I would like
to use kqueue to watch posts dir, but when I last looked this wasn't supported
on the platform.
$ cd ../register
$ forever restart server.js
Phew, there we go.
We are serving up the new blogpost from the site. This seems like a lot of
work, but I think post of the component stages would be required with a static
site generator.
I want to write some tools to help with schduling posts. At the moment I can
write a post for future release, but I have to specify the date for release.
Reading:
The Puzzle Palace, 802.11 Wireless Networks 2nd Edition.