Add a license to your work!

Disclaimer: I am not a lawyer, and this is not legal advice. Please contact an attorney with any questions regarding your specific situation or concerns.

Many times, I come across an interesting repo on GitHub via the trending page, or via the Hacker News front page, or by following some links elsewhere. However, when I get to the repo, I realize it has no license attached to it. What to do?

Including code in blog posts

Including code snippets into a blog post, such as my recent post switching a Hugo theme typically means copy-pasting snippets into your blog post text, surrounded with code fences, but makes the code unusable (it can no longer be compiled or analyzed). Similarly with the output of any given command, log file, etc.

Thus, we keep the canonical copy of the code (or the output) in an external file, and have to periodically manually copy-paste the content back into the blog post, but of course, if we forget, it’s out of date. What if we fix a bug in the code, and forget to include that fix into the blog post? Inaccuracies will confuse our future readers.

How can we automate this process?

Switching a Hugo theme

In the last post on Hugo, we quickly built a simple website with a minimalist Hugo theme. But what if we decide to switch our blog to a different theme? Is it really as simple as changing the name of the theme? Let’s find out!

Building a site with Hugo

I’ve worked with several sites built by Jekyll (written in Ruby), particularly on GitHub Pages, but for this site, I’ve decided to give the Hugo (written in Go) a try.

Why specifically Hugo? Given the Go implementation, I looked forward to not having to deal with Ruby versions & environments, and Ruby gem dependency incompatibilities. Having worked a bit with Go, I was looking forward to a much simpler experience. I also liked several of the themes written for Hugo, and wanted to try some of them out.

So how did it work out for me?