Meta post - How my blog works
- 2 minutes read - 299 wordsA while back, Sharvil requested a quick overview of how I post stuff to my blog, so I thought I’d post a rundown of it.
At the base, I use a git repository to store files named entryNNNN.txt. Each has the basic format:
title: Meta post: How my blog works
date: 2012/07/27
category: software
---
A while back, Sharvil requested a quick overview of how I post stuff to my blog, so I thought I'd post a rundown of it.
At the base, I use a git repository to store files named entryNNNN.txt. Each has the basic format:
To start a new post and fill in some of this, I have a script called ‘newentry.sh’, which determines the latest entry number and adds one to get a new filename (eg, entry0081.txt).
- The title entry is blank by default
- I am hardcoded as the author in the script. (Eventually, I’d like tcjblog to support multiple authors… but it doesn’t yet.)
- Category defaults to ‘personal’, but I probably could have picked ‘software’, instead.
- Content is empty. Everything after the ‘—’ line is parsed as standard jemdoc.
The first pass of my script loops over the entryNNNN.txt files and generates the ‘by date’ and ‘by category’ pages, along with the long index, in the form of .jemdoc files. Then it calls jemdoc on each file to generate the .html files from the .jemdoc files. Finally, the files are all copied to the server. This is all managed by a makefile, so these steps amount to running ‘make clean && make blog && make update.’ Of course, this is a bit of a pain too, so I added it as a post-commit hook in my git repository. Therefore, after I make some updates, I just check them in, and the rest is automatic.