putnam hill moments a place for my stuff

publish jekyll on a personal website

It is done. I made myself a blog! A work in progress, but a big foot in the door.

I decided on Jekyll which compiles a static website. Write posts in Markdown then render with Liquid flavored Ruby. Jekyll is fun to tinker with while not reinventing the wheel.

Git is naturally distributed so I find it interesting that it is mostly used with centralized repositories like Github and Bitbucket. My goal is to host this on my personal website along with the repo.

deploy with git

I created a bare repo on my remote host and added a pre-receive hook to deploy the contents of the rendered _site folder. A combination of write-tree and read-tree can deploy the contents of a repos’ sub folder:

git hook to deploy _site folder: pre-receive

check files that are being pushed

Mark rendered drafts with a meta tag so they can be identified by a bash git-push hook. Add the following to _includes/custom-head.html:

{% assign dir_elements = page.path | split: "/" %}
{% if site.push-draft-detection and dir_elements[0] == '_drafts' %}
<meta name="jekyll-type" content="draft" />
{% endif %}

local script dependencies

  • git hook to examine files that are being pushed and abort if necessary: pre-push
  • bash script to list tags in front matter: get-tags
  • bash script to create tag pages: gen-tags
  • sed script to extract front matter: front-matter.sed
  • sed script to slugify tags: slugify.sed

Add a variable to _config.yml to enable push draft detection:

push-draft-detection: true

Tag grouping courtesy Christian Specht