Blog Setup | Sharat Visweswara

July 9, 2017

Blog Setup

This blog is generated by Hugo, hosted on Github Pages and uses Travis CI to glue them together.

I use two separate repositories: one for my sources, and a separate one for output. Some examples combine both in a single repository, using separate branches for sources and output; but I prefer separate repositories.

The glue is in .travis.yml and it performs the following in order:

  1. Install Hugo using go get.
  2. Clone the output repo into the public subdirectory.
  3. Generate output using hugo; this overwrites existing content in public.
  4. Commit and push changes in public to the output repository.

To enable step 4 I clone the output repo using the https protocol instead of the git protocol, and use a Github Access Token so that Travis can push to the repo as well. The access token is configured in Travis as an environment variable; this avoids exposing it in .travis.yml.

I can now create my posts using Markdown, push my changes to Github, and minute or two later, they’re live!

Let me know if this method works for you, or if you have any other feedback on it.

© Sharat Visweswara 2017