Notes to self

How I use Sublime Text 3 for publishing my Jekyll-based blog

Recently I migrated this very blog from WordPress to Jekyll. One question that inherently follows is how do I write my posts now? Of course, any Markdown editor would do, but I was quite happy to find out there is a Jekyll plugin for my favorite editor Sublime Text that easy the publication.

Installation and configuration

To install jekyll-sublime plugin hit CTRL+SHIFT+P to open Package Control and start typing “Install Package” followed by ENTER, then type “Jekyll” and confirm again.

This is no different than any other Sublime Text plugin installation. As for the configuration, the plugin needs some basic paths to be set. I recommend creating a specific ST project for your website or blog and then use project settings as follows:

{
  "folders":
  [
    {
      "path": "."
    }
  ],
  "settings":
  {
    "Jekyll":
    {
      "jekyll_posts_path": "/home/strzibny/Projects/blog/_posts",
      "jekyll_drafts_path": "/home/strzibny/Projects/blog/_drafts",
      "jekyll_uploads_path": "/home/strzibny/Projects/blog/uploads",
      "jekyll_templates_path": "/home/strzibny/Projects/blog/_templates",
      "jekyll_markdown_extension": "md"
    }
  }
}

Do not forget to change the above to your actual absolute paths. As you can see I also prefer .md as an extension for my files (.markdown would be default). If needed, go through all the options.

Then also add the following two value pairs to Sublime user settings for Markdown completions to work:

  ...
  "auto_complete_selector": "text.html.markdown",
  "auto_complete_triggers": [ {"selector": "text.html.markdown"} ]
  ...

Workflow

So what’s the actual workflow? Jekyll plugin adds some new commands to Package Control. First we should create /_templates directory, hit CTRL+SHIFT+P to open Package Control start typing “New template”.

Once we have a page/post-template ready, we can use “New post from template” command to start editing a new post. Alternatively, we would start with a draft by invoking “New draft from template”. After completing the draft we could promote it to a post with “Promote draft to post”.

During writing we could “Insert upload” to a post as long as we have it ready inside the /uploads directory.

We have also snippets and completions to our disposal.

Yes or no

I like the minimalist approach that Jekyll plugin for Sublime Text is taking. A few things that you remember quickly and which speeds up your publication lifecycle without too much fuss.

Yes, there are no real GUI or preview features, but that’s expected. Moreover, it can play nicely with other plugins like MarkdownPreview. And besides, you might be running jekyll serve in the background anyway. I still hope to find something more productive for handling images to complement it.

Check out my book
Deployment from Scratch is unique Linux book about web application deployment. Learn how deployment works from the first principles rather than YAML files of a specific tool.
by Josef Strzibny
RSS