Editorial Workflows

New Kirby Post

public workflow

Install Workflow...

This workflow contains at least one Python script. Only use it if you trust the person who shared this with you, and if you know exactly what it does.

I understand, install the workflow!

This is a workflow for Editorial, a Markdown and plain text editor for iOS. To download it, you need to view this page on a device that has the app installed.

Description: Updated to v1.1: Post slug is now automatically assigned, based upon the post title, removing any punctuation as needed. You can still amend the slug before continuing but it's mostly complete for you to confirm.

Based upon Gabe Weatherhead's workflow "Timestamp+Title", I've created my first workflow that offers similar functionality to the original, but for Kirby CMS rather than Pelican.

As Kirby requires each blog post to be in its own folder, this workflow uses the Dropbox API so you'll need to make sure you use the DropboxAuth workflow beforehand.

The workflow will prompt for the name to call your folder, create the folder and text file automatically, along with the template prefilled with the required information. For Kirby users, you'll need to adjust the outputted text filenames.

By Jordan Merrick
http://www.sparsebundle.net

Shared by: @jordanmerrick

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
Select from List ?
Title
Post Type
List (Lines)
Link Original
Multiple Selection
OFF
Show in Popover
OFF
Set Variable ?
Variable Name
postType
Value
Input
If… ?
Run the block if
postType
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Link
Request Text Input ?
Title
Paste Link
Initial Text
Browser URL
  • Single Line
  • Multiple Lines
Keyboard Options:
Set Variable ?
Variable Name
postLink
Value
Input
…End If
Request Text Input ?
Title
Enter Title
Initial Text
Browser Title
  • Single Line
  • Multiple Lines
Keyboard Options:
Set Variable ?
Variable Name
titleString
Value
Input
Run Python Script ?
Source Code
#coding: utf-8
import workflow

file_title = workflow.get_variable('titleString')

file_slug = ""
for c in file_title:
    if c in '!,.?:"\';':
        c = ""
    file_slug += c
    
file_slug = file_slug.replace(" ", "-").lower()

workflow.set_variable('postSlug',file_slug)

action_in = workflow.get_input()

#TODO: Generate the output...
action_out = action_in

workflow.set_output(action_out)
Request Text Input ?
Title
Enter Slug
Initial Text
postSlug
  • Single Line
  • Multiple Lines
Keyboard Options:
New Title Post ?
Source Code
#coding: utf-8
import workflow
import keychain
import pickle
import editor
import datetime
import webbrowser
import urllib
from dropbox import session, client

# Begin Dropbox API (make sure to have the DropboxAuth workflow up and running http://dmg.bz/18p3ReS)

dropbox_params_str = keychain.get_password('dropbox', 'all_params')
dropbox_params = pickle.loads(dropbox_params_str)

sess = session.DropboxSession(**dropbox_params['session'])
sess.set_token(**dropbox_params['token'])
dropbox_client = client.DropboxClient(sess)

# Get current date and time
current_time = datetime.datetime.now().strftime('%d %b %Y %H:%M:%S')
current_date = datetime.datetime.now().strftime('%Y%m%d')

# Set some variables that were requested earlier in the workflow

file_title = workflow.get_variable('titleString')
file_slug = workflow.get_variable('postSlug')

# Kirby uses 4 dashes as a separator, it is easier to set this as a variable to avoid mistakes
newline = '\n----\n'

# I have two templates for Kirby, one for link posts and one for original posts. 

file_name = 'article.text.txt'
file_content = 'title: ' + file_title + newline + 'date: ' + current_time + newline + 'tags: article, published, curated' + newline + 'draft: true' + newline + 'text:\n\n'

# Change output if link post was selected
if workflow.get_variable('postType') == 'Link':
	file_name = 'article.link.txt'
	out_link = 'link: ' + workflow.get_variable('postLink')
	file_content = 'title: ' + file_title + newline + 'date: ' + current_time + newline + out_link + newline + 'tags: article, published, curated' + newline + 'draft: true' + newline + 'text:\n\n'

# Set where you want to create your new folder and text file

file_path = 'Sparsebundle/Kirby Content/posts/'+file_slug+'/'+file_name

# Create the file and folder on Dropbox

dropbox_client.put_file(file_path, file_content)

action_in = workflow.get_input()

#TODO: Generate the output...
action_out = action_in

workflow.set_output(action_out)
Move Caret ?
Direction
  • Backward
  • Forward
  • Start/End of Document
  • Start/End of Line
  • Number of Characters:
1