Blogging with Emacs on tilde.team
When blogging on tilde.team, I really like the small bb
utility for posting,
as it handles both WWW and Gopher easily. However, I don’t like writing my
posts over SSH - mainly because my GUI Emacs is nicer to use when it comes
to key bindings.
Therefore I decided to create a small script or similar for posting from my desktop emacs. This post contains the steps that I use, in case someone wants to do the same.
Just write markdown
As an Emacs user, I am of course heavily using org-mode. So I thought on writing my blog posts in org and export them as markdown. However, that adds some additional challenges:
- The markdown export from org creates some weird, empty HTML links in the file (reason unknown).
- The first line in the file is the title of the post, without any formatting (e.g.
#
). - The last line contains the tags. These are stored in org usually at the top.
So naturally I thought of using an elisp macro, a shell script or similar to make the required adjustments after the markdown export from org, but then I decided just to write markdown. That saves me all the headache of maintaining another piece of (very small) software.
Post over SSH
For posting the finished post over SSH, I thought of using either tramp, eshell, a regular shell script or a combination of them.
In the end, I decided that a very simple elisp snippet:
(defun blog-post() (interactive) (shell-command (format "scp %s tilde:" (buffer-file-name)) nil nil) (async-shell-command (format "ssh tilde bb post %s" (buffer-name))) )