So far I'm totally sold on Jekyll. Writing blog posts in text files with markdown is very satisfying.
Deploying code is pretty trivial, which is the part that really sold me on moving to a static site. All I need is a local repo and a remote on my server. One thing that was kind of annoying right away was having multiple copies of all of my files. Since I'm on a small vps, I need to be a little considerate of file usage. Initially I was using a bare repo on the server to push code to. Then I had a non-bare repo on the server using that as its origin, which was using hooks to update. Since Jekyll essentially makes a duplicate of your assets when compiling your site, you end up with double the images, etc. Since I had one repo locally and one bare plus one non-bare on the server, that meant five copies of my files.
I've since switched to just using the non-bare repository as my remote which only reduces the copies by one, but I feel slightly better. Git doesn't like it when you try to update the working branch of a remote, so I used the following two hooks to switch to a temp branch, update and switch back. I might rework these a bit to create tags or do some sanity checking, but for now I'm happy. To deploy, I just create a new blog file, then run a script to compile the jekyll site, commit and push. Done.
#!/bin/bash set -e unset GIT_DIR echo "Check out temp branch..." cd /var/www/jekyll/kevinhankens.com && git checkout -b temp echo "Done"
#!/bin/bash set -e unset GIT_DIR echo "Check out master..." cd /var/www/jekyll/kevinhankens.com && git checkout master echo "Done" echo "Remove temp branch..." cd /var/www/jekyll/kevinhankens.com && git branch -D temp echo "Done"
To deploy, I just use the following simple script:
#!/bin/bash set -e pwd echo "Generating Site" jekyll --no-server echo "Done" echo "Committing..." git add . echo "Done" echo "Committing..." git commit echo "Done" echo "Pushing..." git push origin master echo "Done"
This is all pretty rudimentary, but fun to see in action. Next up, I'm hoping to play a bit more with liquid templates and plugins/filters. It would also be fun to create a nice rake task to handle the code deployment and maybe prepopulating markdown files for authoring. jekyll.vim looks promising in that regard :)