├── Mr. Poole.alfredworkflow └── README.md /Mr. Poole.alfredworkflow: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chfvoigt/mrpoole/HEAD/Mr. Poole.alfredworkflow -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Mr. Poole - Dr. Jekyll's Butler 2 | 3 | ## Overview 4 | 5 | Mr. Poole is an [Alfred.app](http://www.alfredapp.com) workflow for [Jekyll](http://jekyllrb.com) sites. He is Dr. Jekyll's butler and tries to take the drudgery out of running a static site. Mr. Poole will assist you by... 6 | 7 | * creating, opening and publishing drafts of regular as well as link and video posts 8 | * opening existing posts for editing 9 | * opening existing pages for editing 10 | * starting a local server with the site including drafts 11 | * opening the site folder in Sublime Text for development plus the above 12 | * deploying the site to your server with rsync 13 | * tweeting about (new) posts 14 | 15 | ## The commands 16 | 17 | ### Draft commands 18 | 19 | *New draft*: Add the title as an argument. It creates a new draft file in the *_drafts* folder of your Jekyll site, then adds a front matter template with the title and default values defined in the script. The filename is the lowercase, hyphenated version of the title. 20 | 21 | *New link post draft*: Reads the URL, title and selection from the active Safari tab and creates a new linked-list style draft with the page title, date, external URL and the selection (as Markdown quote) filled in. Requires modified Jekyll templates (cf. below). 22 | 23 | *New video post draft*: Reads the video ID, title and selection from a Youtube or Vimeo video page in Safari and creates a new video post draft with the page title, date, video ID and the selection (as Markdown quote) filled in. Requires modified Jekyll templates (cf. below). 24 | 25 | *Open draft*: Returns all of your existing drafts sorted by modification date (newest first). Selected post will be opened. 26 | 27 | *Publish draft*: Lets you choose an existing draft, adds the current date to the beginning of the filename and moves it to the *_posts* folder. Builds the site and deploys it to your remote server. Opens your site in the standard browser. 28 | 29 | ### Post commands 30 | 31 | *Open post*: Returns a list of your existing posts in reverse chronological order and opens the selected post for editing. 32 | 33 | *Tweet post*: Requires a page on your domain in the active window / tab of Safari. Reads the URL and the title and opens an editable tweet about the article. Requires [Tweetbot for Mac](http://tapbots.com/software/tweetbot/mac/). 34 | 35 | ### Page commands 36 | 37 | *New page*: Takes a page name as an argument. Creates a markdown page file. The filename is the lowercase, hyphenated version of the title.. Fills in a template front matter with the title and default values defined in the script. It creates subfolders if given. Example: The argument `/resources/A list of my downloads/` will create the file `path/to/jekyll/resources/a-list-of-my-downloads.md`. 38 | 39 | *Open page*: Returns a list of all .md files inside the Jekyll folder including subdirectories sorted by date of last modification, excluding only those in folders prefixed with an underscore such as `_posts` and `_drafts`. Opens selection for editing. 40 | 41 | ### Site management commands 42 | 43 | *Deploy site*: Builds the site and uses rsync to deploy it to the remote server. Opens the URL in the browser. 44 | 45 | *Serve site*: Builds the site with drafts, starts the local server and opens the URL. Regenerates the site when files are changed. 46 | 47 | *Edit site*: Same as *Serve site*, but additionally opens the site folder in Sublime Text. 48 | 49 | ## Requirements 50 | 51 | ### General 52 | 53 | To use this workflow with only the modifications listed in the next section, you need to have... 54 | 55 | * a local Jekyll installation 56 | * a local Jekyll site folder 57 | * a remote server with SSH access 58 | * working public key authentication for SSH access 59 | * templates that support Link and video posts (they are not supported by Jekyll out of the box - read the next section for more information) 60 | * [Tweetbot for Mac](http://tapbots.com/software/tweetbot/mac/) in case you need the *Tweet post* command 61 | 62 | ### Link and video post support 63 | 64 | Link and video posts do not work with a standard Jekyll setup. You have to modify your site to support these post formats. Two starting points might be my short blog posts on [link posts](http://frederikvoigt.de/2014/07/12/link-posts-for-jekyll-sites/) and [video posts](http://frederikvoigt.de/2014/07/11/simple-video-posts-for-jekyll-sites/) with Jekyll (which lead back to GitHub for detailed instructions). 65 | 66 | ## Getting started 67 | 68 | To get started, go through each of the script filters and scripts and do the following: 69 | 70 | * make sure there's a `_drafts` folder inside your site directory 71 | * adjust the `sitedir`, `extension` and other variables 72 | * adjust the url of your blog in all open commands pointing at the remote site (*not* in those pointing at localhost) 73 | * adjust the remote server data in all rsync commands 74 | * if you use a different editor, adjust all references to Sublime Text or just remove them to use your default app instead (for some editors this will probably break the "jy-develop-site" which opens a directory instead of a file) 75 | * if you do not use Safari as your standard browser, you need to change that in the Apple Scripts too (check whether your browser supports Apple Script first) 76 | 77 | ## Todo 78 | 79 | * if a page with a subdirectory is created, the title in the YAML front matter will contain the directory name too - for the time being it must be removed manually 80 | 81 | ## Disclaimer 82 | 83 | I'm a noob and did this to learn a little bit about shell scripts. The workflow is functional on my Mac, but it can certainly be improved. If you encounter any problems or have suggestions, please use [this repository's issue tracker](https://github.com/frederikvoigt/mrpoole/issues). 84 | 85 | ## Acknowledgements 86 | 87 | * Script filters are based on Vítor's RecentDownloads workflow. Thanks, Vítor! 88 | * Internet people, thank you for all the tutorials and resources that helped me get started with this workflow! 89 | 90 | ## Changelog 91 | 92 | ### v.6 93 | 94 | * added: *New link post draft* command (only for modified Jekyll sites - please the *Link and video posts* section) 95 | * added: *New video post draft* command (only for modified Jekyll sites - please the *Link and video posts* section) 96 | * added: *Tweet article* command (requires [Tweetbot for Mac](http://tapbots.com/software/tweetbot/mac/)) 97 | * change: added a sed line to the *Publish draft* action that replaces the `date:` line in the post's YAML front matter with a line containing current date and time to ensure the correct order of multiple posts from the same date 98 | * change: the current date is now added to the front matter of new drafts and pages 99 | * change: added lowercase conversion for new filenames throughout the workflow 100 | 101 | ### v.5 102 | 103 | * renamed and shortened keywords 104 | * changed action descriptions 105 | * changed "blog" to "site" throughout the workflow 106 | * corrected typos 107 | 108 | ### v.4 109 | 110 | * renamed keywords to better fit my workflow 111 | 112 | ### v.3 113 | 114 | * Mr. Poole now uses variables for user dependent values throughout all scripts and script filters to facilitate customization 115 | 116 | ## Download 117 | https://github.com/frederikvoigt/mrpoole 118 | --------------------------------------------------------------------------------