Combining Drafts and Working Copy

Both Drafts and Working Copy form the core of my workflow in publishing posts to my Github hosted website. One of the requirements of a Jekyll hosted Github blog is that posts must be named in a particular way i.e. In order to automate the naming of posts from Drafts I wrote the following Javascript to run as an action in Drafts:

var str = draft.processTemplate("[[title]]");
var res = str.replace(/\s/g, "-");
draft.defineTag("hyphentitle", res);

In order to send the post from Drafts to Working Copy the Draft action has, as a second step, the following x-callback-url:

working-copy://x-callback-url/write/?repo={{name.of.github.repo}}&path={{_posts/}}[[date]]-[[hyphentitle]].md&text=---%0a{{layout: post}}%0a{{title: }}[[title]]%0a---%0a[[body]]&key={{key}}

With one action I can automate the naming and posting of my blog post.

Written on January 18, 2017