February 28, 2018
As a software developer and systems administrator, I’ve always enjoyed playing around with coding up websites. This has been more of an effort to see what I can do than to actually say something. The end result has typically been a few unfinished components of a homebrew content management system, maybe if I’m lucky involving a form or two where I can edit blog posts.
Recently I’ve gotten into wildlife photography, so I do have actual content I want to share. I’ve also gotten more active in the python community, so having an actual platform to publish simple blog posts would be nice. At the same time, simply standing up wordpress is not enough fun.
With this in mind, I rewrote my simple one-page site into a static blog using jekyll. Jekyll is nice for a developer as it allows me to manage the site using the same tools that I use for documenting anything else: git and markdown.
An example post is a picture of a Barred Owl I took:
---
layout: photopost
title: Barred Owl
category: metazoa
mclass: Aves
mimage: 20171230_barred_owl_s.jpg
---
Taken at Radnor Lake State Park, Tennessee.
That’s all there is - it gets dumped in a file
/_posts/2017-12-30-barred-owl.md
. I can add these small files in a fraction
of the time it takes me to Photoshop a RAW image, which is what I’m going for.
The main pages are aware of all the files in the _posts
directory and update
their links and entries.
When I run jekyll build
, jekyll converts it into static html
using the specifed layout /_layouts/photopost.html
, shown below:
<!DOCTYPE html>
<html lang="en">
{% include header.html %}
<body>
{% include navbar.html %}
{% include titlesplash-date.html %}
<div class="container">
<div class="row">
<div class="col-xs-12 col-md-12 photopost">
{{ content }}
</div>
</div>
</div>
{% include bootstrap-core.html %}
</body>
</html>
With the liquid templating (double curly braces) I can pull apart ugly
snippets of html and reuse them in various layouts as needed.
Once I make changes I just commit them to my repo, and then I have a
tiny little AWS t2.nano instance controlled by
ansible. I can just run a command
ansible-playbook -i hosts infra.yml --tags "ericwebsite-update"
which
skips most of the plays, and pulls the latest website source from the
repo then runs jekyll to compile it. That gets served by
nginx with a certificate from
LetsEncrypt.
This keeps things simple, but allows me to play around with more complex stuff as I get interested, and also keeps everything in a format that is simple to parse, manipulate, and migrate to something else.