Last week, I published a posted on user stories to my Scriptogram account.

I’d been writing the post for a while and versioning it in a folder of its own so I could see my progress as I wrote. As I was writing, I realised that at some point I would have to add the information that Scriptogram requires to the top of the post.


Scriptogram requires as a basic minimum a title and a date but allows other fields as well, like “Tags” (keywords associated with your post), “Excerpt” (a short summary of your post), “Link” (for when the title of a post should go somewhere other than the post), “Slug” (for how the URL for your post should look), even “Published” (which you can set as false should you want your post to sit in draft).

The data that sat at the top of my post last week would have looked like this:

Title: Writing user stories
Date: 2014-10-05 11:32
Published: True
Tags: project management, requirements gathering, user stories, UX


But it seemed a shame to have to add these fields to the top of otherwise clean Markdown content. After all, I’m not set on Scriptogram yet and if I decide I want to move all my posts elsewhere, I will then need to go and change the fields at the top of each post to whatever format the new platform requires.

It felt to me like this metadata should sit in a separate file. That way, content could just be content, but the data about the file could still be accessed if needed. I decided to write a script that would allow me to do this but that would still allow me to give Scriptogram everything it needed to display my post properly.


I decided to put all the fields shown above into a file called metascrp.txt. (The “meta” clues me into its being metadata, the “scrp” to its specifically being for Scriptogram.)

I then amended my curl script (mentioned in a previous post, “Curling up with Scriptogram”) to account for this. The end result is a script I can run whenever I’m ready to publish to Scriptogram. I’ve made the script available as a Gist but it’s only short so you can see it in its entirety here:

# Usage: ./ [OPTION]... [FILE]
# Publish FILE to account (grabbing metadata as we go).
# FILE should have no extension.
# Expects metascrp.txt accompanying named file to pull metadata from.
# Expects there two text files in location of script,
# one containing app key for Scriptogram,
# the other containing the user ID.
# 	-d 		Delete file.

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

if [ "$1" == "-d" ]
	echo "Deleting..."
	fileparam="-d filename=$"
	echo $2
	echo "Adding..."
	fileparam="-d name=$1"

’$(<$ echo $1 fi

curl \
       --data-urlencode app_key@"$DIR/scrpakey.txt" \
       --data-urlencode user_id@"$DIR/scrpuser.txt" \
       "$fileparam" \
       --data-urlencode text="$filedata" \


I’ve saved the script as I go into the folder where I’ve been writing my draft post and where I’ve also stored the metascrp.txt file containing the metadata. I call from within the folder (at the moment by backtracking with ../../) and it pulls the metadata and post contents together and publishes them directly to my Scriptogram.

In order to publish, a Scriptogram app key and user ID are required. So that I could share the code, I’ve put the key and ID into separate text files that sit with To use this script yourself, make sure when you save it that you have two files scrpakey.txt and scrpuser.txt, containing just your app key and your user id respectively.

What next?

As said before, the whole point of this is that I don’t want to be tied to Scriptogram. I want to write in a platform-neutral or -agnostic way that allows me control over versioning, storage, etc, but that allows me to efficiently push my posts out to whatever platform I’m currently using.

It seems natural that the next step to this should be that I automate the creation of the metadata in metascrp.txt, by automatically taking care of the date-time stamp when publishing, for example, and by creating a separate and flexible tags file.

However, I also need to give some thought to the workflow around my writing in general.