I recently converted my blog from Octopress to Hugo. I really like Hugo. It’s easy to use and ridiculously fast. Hugo also aligns well with my recent foray into Go and it’s been a delight to comb through the source code.
Given the infrequency of my posts I usually have to re-learn my blog workflow every time I created a new post. To make things easier I put together a README that details my post/publish workflow. I’ve posted my workflow below. I hope you find it useful!
This is the repository for illyabusigin.com. This blog is built with Hugo, a static site generator written in Go and hosted in S3. Because this blog is a static site and hosted on S3 there are zero scalability concerns.
The repository layout is below. I’ve omitted some folders and files for brevity.
/README.md /blog - config.toml - content/ - about/ - archive/ - code/ - post/ - public/ - static/ - themes/
In order to create new posts and publish you will need to install a few tools. You can install these tools via Homebrew:
brew install hugo brew install s3cmd
s3cmd you will need to configure it with the appropriate S3 access key and signature key. You can invoke the setup process with
s3cmd --configure command.
Create New Post
The blog resides in the
blog/ folder. Content is organized by year. To create a new post for 2015 you would execute the following command:
cd ~/blog/ hugo new post/2015/post_name.md
Hugo has the ability to create a local copy of your site with live reload when content changes. To stand up this local site, execute the following command:
hugo server -wD // -w watch filesystem for changes and recreate as needed // -D include content marked as draft
hugo help to see a list of all hugo commands.
Publishing your blog is easy with s3cmd. Assuming you configured s3cmd you would perform the following command:
// Navigate to the blog/ directory in your repo hugo | s3cmd sync ./public/ s3://www.illyabusigin.com/
Let’s dissect what’s going on in the publishing step:
Navigate to the root directory of your repostitory.
hugogenerates the live version of your site. It’s very important to run this command as running
hugo servergenerates a local version of your site that is not suitable for upload.
s3cmd sync ./public/ s3://www.illyabusigin.com/synchronizes the contents of the public folder with your S3 bucket.